class Algebrick::DSL::TypeDefinitionScope

Attributes

new_type[R]

Public Class Methods

new(new_type, &block) click to toggle source
# File lib/algebrick/dsl.rb, line 33
def initialize(new_type, &block)
  @new_type = Type! new_type, ProductVariant, ParametrizedType
  instance_exec @new_type, &block
  @new_type.kind if @new_type.is_a? ProductVariant
end

Public Instance Methods

all_field_readers() click to toggle source
# File lib/algebrick/dsl.rb, line 66
def all_field_readers
  @new_type.add_all_field_method_readers
  self
end
Also aliased as: all_readers
all_readers()
Alias for: all_field_readers
field_readers(*names) click to toggle source
# File lib/algebrick/dsl.rb, line 59
def field_readers(*names)
  @new_type.add_field_method_readers *names
  self
end
Also aliased as: readers
fields(*fields) click to toggle source
# File lib/algebrick/dsl.rb, line 39
def fields(*fields)
  @new_type.set_fields fields.first.is_a?(Hash) ? fields.first : fields
  self
end
fields!(*fields) click to toggle source
# File lib/algebrick/dsl.rb, line 44
def fields!(*fields)
  fields(*fields)
  all_readers
end
final!() click to toggle source
# File lib/algebrick/dsl.rb, line 49
def final!
  @new_type.final!
  self
end
readers(*names)
Alias for: field_readers
variants(*variants) click to toggle source
# File lib/algebrick/dsl.rb, line 54
def variants(*variants)
  @new_type.set_variants *variants
  self
end