Class: Yoda::Model::Types::SequenceType

Inherits:
Base
  • Object
show all
Defined in:
lib/yoda/model/types/sequence_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==

Constructor Details

#initialize(base_type, types) ⇒ SequenceType

Returns a new instance of SequenceType.

Parameters:



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_typeObject (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

#typesObject (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

Parameters:

  • paths (Array<Path>)

Returns:

  • (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

Parameters:

  • another (Object)

Returns:

  • (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

#hashObject



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

Returns:

  • (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

#nameObject



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>

Parameters:

  • registry (Registry)

Returns:



37
38
39
# File 'lib/yoda/model/types/sequence_type.rb', line 37

def resolve(registry)
  base_type.resolve(registry)
end

#to_sString

Returns:

  • (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