class Algebrick::ProductConstructors::Basic

Public Class Methods

type=(type) click to toggle source
# File lib/algebrick/product_constructors/basic.rb, line 37
def self.type=(type)
  super(type)
  raise if type.field_names?
end

Public Instance Methods

pretty_print(q) click to toggle source
# File lib/algebrick/product_constructors/basic.rb, line 23
def pretty_print(q)
  q.group(1, "#{self.class.type.name}[", ']') do
    fields.each_with_index do |value, i|
      if i == 0
        q.breakable ''
      else
        q.text ','
        q.breakable ' '
      end
      q.pp value
    end
  end
end
to_s() click to toggle source
# File lib/algebrick/product_constructors/basic.rb, line 18
def to_s
  "#{self.class.type.name}[" +
      fields.map(&:to_s).join(', ') + ']'
end
update(fields) click to toggle source
# File lib/algebrick/product_constructors/basic.rb, line 42
def update(fields)
  type[*fields]
end