class AMA::Entity::Mapper::Path::Segment

Well, that's quite self-explanatory. Path consists of segments, and here's one.

Attributes

name[R]
prefix[R]
suffix[R]

Public Class Methods

attribute(name) click to toggle source
# File lib/ama-entity-mapper/path/segment.rb, line 39
def attribute(name)
  new(name, '.')
end
index(name) click to toggle source
# File lib/ama-entity-mapper/path/segment.rb, line 43
def index(name)
  new(name, '[', ']')
end
new(name, prefix = nil, suffix = nil) click to toggle source
# File lib/ama-entity-mapper/path/segment.rb, line 14
def initialize(name, prefix = nil, suffix = nil)
  @name = name
  @prefix = prefix
  @suffix = suffix
end

Public Instance Methods

==(other) click to toggle source
# File lib/ama-entity-mapper/path/segment.rb, line 34
def ==(other)
  eql?(other)
end
eql?(other) click to toggle source
# File lib/ama-entity-mapper/path/segment.rb, line 28
def eql?(other)
  return false unless other.is_a?(self.class)
  @name == other.name && @prefix == other.prefix &&
    @suffix == other.suffix
end
hash() click to toggle source
# File lib/ama-entity-mapper/path/segment.rb, line 24
def hash
  @name.hash ^ @prefix.hash ^ @suffix.hash
end
to_s() click to toggle source
# File lib/ama-entity-mapper/path/segment.rb, line 20
def to_s
  "#{@prefix}#{@name}#{@suffix}"
end