Sha256: 3a10ed7ef07c0553e00612ebf351042b944004478de5106da98340894d690b77

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

module Viiite
  class Command
    class Plot

      options do |opt|
        @render = :text
        opt.on('--text', "Render output as a text table") do
          @render = :text
        end
      end

      def to_text_query(lispy, op)
        lispy = Alf.lispy
        op = lispy.summarize(op, [@graph, @series, @abscissa].compact,
                                 {:y => "avg{ #{@ordinate} }"})
        op = lispy.rename(op, @graph  => :graph, @abscissa => :x, @series => :serie)
        op = lispy.group(op, [:x, :y], :data)
        op = lispy.rename(op, :serie => :title)
        op = lispy.group(op, [:graph], :series, {:allbut => true})
        op = lispy.rename(op, :graph => :title)
        op
      end

      def to_text(lispy, op)
        Alf::Renderer.text(op).execute($stdout)
      end

    end # class Plot
  end # class Command
end # module Viiite

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
viiite-0.2.0 lib/viiite/command/plot/to_text.rb