Class: Yoda::Model::Types::SequenceType
- Defined in:
- lib/yoda/model/types/sequence_type.rb
Instance Attribute Summary collapse
-
#base_type ⇒ Object
readonly
Returns the value of attribute base_type.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #change_root(paths) ⇒ self
- #eql?(another) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(base_type, types) ⇒ SequenceType
constructor
A new instance of SequenceType.
- #map(&block) ⇒ self
- #name ⇒ Object
- #resolve(registry) ⇒ Array<Store::Objects::Base>
- #to_s ⇒ String
Methods inherited from Base
Constructor Details
#initialize(base_type, types) ⇒ SequenceType
Returns a new instance of SequenceType.
9 10 11 12 |
# File 'lib/yoda/model/types/sequence_type.rb', line 9 def initialize(base_type, types) @base_type = base_type @types = types end |
Instance Attribute Details
#base_type ⇒ Object (readonly)
Returns the value of attribute base_type.
5 6 7 |
# File 'lib/yoda/model/types/sequence_type.rb', line 5 def base_type @base_type end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
5 6 7 |
# File 'lib/yoda/model/types/sequence_type.rb', line 5 def types @types end |
Instance Method Details
#change_root(paths) ⇒ self
31 32 33 |
# File 'lib/yoda/model/types/sequence_type.rb', line 31 def change_root(paths) self.class.new(base_type.change_root(paths), types.map { |type| type.change_root(paths) }) end |
#eql?(another) ⇒ Boolean
19 20 21 22 23 |
# File 'lib/yoda/model/types/sequence_type.rb', line 19 def eql?(another) another.is_a?(SequenceType) && base_type == another.base_type && types == another.types end |
#hash ⇒ Object
25 26 27 |
# File 'lib/yoda/model/types/sequence_type.rb', line 25 def hash [self.class.name, base_type, types].hash end |
#map(&block) ⇒ self
47 48 49 |
# File 'lib/yoda/model/types/sequence_type.rb', line 47 def map(&block) self.class.new(base_type.map(&block), types.map(&block)) end |
#name ⇒ Object
14 15 16 |
# File 'lib/yoda/model/types/sequence_type.rb', line 14 def name base_type.name end |
#resolve(registry) ⇒ Array<Store::Objects::Base>
37 38 39 |
# File 'lib/yoda/model/types/sequence_type.rb', line 37 def resolve(registry) base_type.resolve(registry) end |
#to_s ⇒ String
42 43 44 |
# File 'lib/yoda/model/types/sequence_type.rb', line 42 def to_s "#{base_type}(#{types.map(&:to_s).join(', ')})" end |