Module: Finitio::CollectionType
Instance Attribute Summary collapse
-
#elm_type ⇒ Object
readonly
Returns the value of attribute elm_type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
- #initialize(elm_type, name = nil, metadata = nil) ⇒ Object
- #resolve_proxies(system) ⇒ Object
- #suppremum(other) ⇒ Object
- #unconstrained ⇒ Object
Instance Attribute Details
#elm_type ⇒ Object (readonly)
Returns the value of attribute elm_type.
12 13 14 |
# File 'lib/finitio/type/collection_type.rb', line 12 def elm_type @elm_type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
14 15 16 |
# File 'lib/finitio/type/collection_type.rb', line 14 def ==(other) super || (other.is_a?(self.class) && elm_type == other.elm_type) end |
#hash ⇒ Object
19 20 21 |
# File 'lib/finitio/type/collection_type.rb', line 19 def hash self.class.hash ^ self.elm_type.hash end |
#initialize(elm_type, name = nil, metadata = nil) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/finitio/type/collection_type.rb', line 4 def initialize(elm_type, name = nil, = nil) unless elm_type.is_a?(Type) raise ArgumentError, "Finitio::Type expected, got `#{elm_type}`" end super(name, ) @elm_type = elm_type end |
#resolve_proxies(system) ⇒ Object
30 31 32 |
# File 'lib/finitio/type/collection_type.rb', line 30 def resolve_proxies(system) self.class.new(elm_type.resolve_proxies(system), name, ) end |
#suppremum(other) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/finitio/type/collection_type.rb', line 23 def suppremum(other) return super unless other.is_a?(CollectionType) return self if other.is_a?(CollectionType) && elm_type == other.elm_type builder = self.class == other.class ? self.class : SeqType builder.new(elm_type.suppremum(other.elm_type)) end |
#unconstrained ⇒ Object
34 35 36 |
# File 'lib/finitio/type/collection_type.rb', line 34 def unconstrained self.class.new(elm_type.unconstrained, name, ) end |