Class: StructureDigest::SchemaParts::Path
- Inherits:
-
Object
- Object
- StructureDigest::SchemaParts::Path
- Defined in:
- lib/structure_digest/path.rb
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #abstract ⇒ Object
- #add_part(part) ⇒ Object
- #hash ⇒ Object
-
#initialize(parts = []) ⇒ Path
constructor
A new instance of Path.
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
#parts ⇒ Object (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 |
#abstract ⇒ Object
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 |
#hash ⇒ Object
21 |
# File 'lib/structure_digest/path.rb', line 21 def hash; [@parts].hash; end |