class Bmg::Type

Constants

ANY

Public Class Methods

new(predicate = Predicate.tautology) click to toggle source
# File lib/bmg/type.rb, line 4
def initialize(predicate = Predicate.tautology)
  @predicate = predicate
  @typechecked = false
  raise ArgumentError if @predicate.nil?
end

Public Instance Methods

_keys()
Alias for: keys
keys() click to toggle source
# File lib/bmg/type.rb, line 77
def keys
  return @keys.to_a if @keys
  return [attrlist] if knows_attrlist?
  nil
end
Also aliased as: _keys
knows_attrlist!() click to toggle source
# File lib/bmg/type.rb, line 59
def knows_attrlist!
  raise UnknownAttributesError unless knows_attrlist?
end
knows_attrlist?() click to toggle source
# File lib/bmg/type.rb, line 55
def knows_attrlist?
  !self.attrlist.nil?
end
knows_keys?() click to toggle source
# File lib/bmg/type.rb, line 73
def knows_keys?
  !!@keys
end
to_attrlist() click to toggle source
# File lib/bmg/type.rb, line 63
def to_attrlist
  self.attrlist
end
typechecked?() click to toggle source
# File lib/bmg/type.rb, line 17
def typechecked?
  @typechecked
end
with_attrlist(attrlist) click to toggle source
# File lib/bmg/type.rb, line 49
def with_attrlist(attrlist)
  dup.tap{|x|
    x.attrlist = attrlist
  }
end
with_keys(keys) click to toggle source
# File lib/bmg/type.rb, line 83
def with_keys(keys)
  dup.tap{|x|
    x.keys = keys ? Keys.new(keys) : nil
  }
end
with_predicate(predicate) click to toggle source
# File lib/bmg/type.rb, line 38
def with_predicate(predicate)
  dup.tap{|x|
    x.predicate = predicate
  }
end
with_typecheck() click to toggle source
# File lib/bmg/type.rb, line 21
def with_typecheck
  dup.tap{|x|
    x.typechecked = true
  }
end
without_typecheck() click to toggle source
# File lib/bmg/type.rb, line 27
def without_typecheck
  dup.tap{|x|
    x.typechecked = false
  }
end