Sha256: 0994226d0b144fe575f4ccd27260d84cbf47fd176ef84b7be1a7acc16f76b12b

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

require_relative 'pane/column'
require_relative 'pane/line'

module Proforma
  module Modeling
    # Think of a pane like a pivoted table.  It has columns but not in the same respect as
    # a table's columns.  For a pane, it makes up a vertical section.  Each column (section)
    # then has a number of lines which holds the label:value pairs that facilitates data
    # rendering.
    class Pane
      include Compiling::Compilable
      acts_as_hashable

      attr_writer :columns

      def initialize(columns: [])
        @columns = Column.array(columns)
      end

      def columns
        Array(@columns)
      end

      def compile(data, evaluator)
        compiled_columns = columns.map { |column| column.compile(data, evaluator) }

        self.class.new(columns: compiled_columns)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proforma-1.0.2 lib/proforma/modeling/pane.rb
proforma-1.0.1 lib/proforma/modeling/pane.rb
proforma-1.0.0 lib/proforma/modeling/pane.rb
proforma-1.0.0.pre.alpha lib/proforma/modeling/pane.rb