Sha256: b2206cb3d45436dcdabadc92ada6e99aa0ecc8c2ca7654c6b76821e1618abcf6

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

class Report
  class Head
    class Row
      attr_reader :head
      attr_reader :cells
      def initialize(head, cells)
        @head = head
        @cells = cells
      end
      def read(report)
        cells.map do |cell|
          case cell
          when String
            cell
          when Symbol
            unless report.respond_to?(cell)
              raise "#{report.inspect} doesn't respond to #{cell.inspect}"
            end
            report.send cell
          else
            raise "must pass String or Symbol to head row"
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
report-0.0.1 lib/report/head/row.rb