Class: StructureDigest::SchemaParts::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/structure_digest/path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parts = []) ⇒ Path

Returns a new instance of Path.



4
5
6
# File 'lib/structure_digest/path.rb', line 4

def initialize(parts=[])
  @parts = parts
end

Instance Attribute Details

#partsObject (readonly)

Returns the value of attribute parts.



16
17
18
# File 'lib/structure_digest/path.rb', line 16

def parts
  @parts
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



17
18
19
# File 'lib/structure_digest/path.rb', line 17

def ==(other)
  self.class == other.class && @parts == other.parts
end

#abstractObject



8
9
10
# File 'lib/structure_digest/path.rb', line 8

def abstract
  AbstractPath.new(@parts.map(&:abstract).compact)
end

#add_part(part) ⇒ Object



12
13
14
# File 'lib/structure_digest/path.rb', line 12

def add_part(part)
  Path.new(@parts + [part])
end

#hashObject



21
# File 'lib/structure_digest/path.rb', line 21

def hash; [@parts].hash; end