Class: Yoda::Model::Types::InstanceType

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #map

Constructor Details

#initialize(path) ⇒ InstanceType

Returns a new instance of InstanceType.

Parameters:



9
10
11
# File 'lib/yoda/model/types/instance_type.rb', line 9

def initialize(path)
  @path = ScopedPath.build(path)
end

Instance Attribute Details

#pathScopedPath (readonly)

Returns:



6
7
8
# File 'lib/yoda/model/types/instance_type.rb', line 6

def path
  @path
end

Instance Method Details

#change_root(paths) ⇒ self

Parameters:

  • paths (Array<Path>)

Returns:

  • (self)


25
26
27
# File 'lib/yoda/model/types/instance_type.rb', line 25

def change_root(paths)
  self.class.new(path.change_scope(paths))
end

#eql?(another) ⇒ Boolean

Parameters:

  • another (Object)

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/yoda/model/types/instance_type.rb', line 14

def eql?(another)
  another.is_a?(InstanceType) &&
  path == another.path
end

#hashObject



19
20
21
# File 'lib/yoda/model/types/instance_type.rb', line 19

def hash
  [self.class.name, path].hash
end

#resolve(registry) ⇒ Array<Store::Objects::Base>

Parameters:

  • registry (Registry)

Returns:



31
32
33
# File 'lib/yoda/model/types/instance_type.rb', line 31

def resolve(registry)
  [Store::Query::FindConstant.new(registry).find(path)].compact
end

#to_sString

Returns:

  • (String)


36
37
38
# File 'lib/yoda/model/types/instance_type.rb', line 36

def to_s
  path.path.to_s
end