class ThomasUtils::KeyChild

Attributes

child[R]
key[R]

Public Class Methods

new(key, child) click to toggle source
# File lib/thomas_utils/key_child.rb, line 7
def initialize(key, child)
  @key = key
  @child = child
end

Public Instance Methods

==(rhs) click to toggle source
# File lib/thomas_utils/key_child.rb, line 29
def ==(rhs)
  rhs.is_a?(KeyChild) && key == rhs.key && child == rhs.child
end
Also aliased as: eql?
eql?(rhs)
Alias for: ==
hash() click to toggle source
# File lib/thomas_utils/key_child.rb, line 34
def hash
  to_s.hash
end
new_key(key) click to toggle source
# File lib/thomas_utils/key_child.rb, line 12
def new_key(key)
  KeyChild.new(key, child)
end
quote(quote) click to toggle source
# File lib/thomas_utils/key_child.rb, line 16
def quote(quote)
  quoted_key = if key.respond_to?(:quote)
                 key.quote(quote)
               else
                 "#{quote}#{key}#{quote}"
               end
  "#{quoted_key}.#{quote}#{child}#{quote}"
end
to_s() click to toggle source
# File lib/thomas_utils/key_child.rb, line 25
def to_s
  "#{@key}.#{@child}"
end