Class: Lutaml::Store::StorageKey
- Inherits:
-
Object
- Object
- Lutaml::Store::StorageKey
- Defined in:
- lib/lutaml/store/storage_key.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#key_value ⇒ Object
readonly
Returns the value of attribute key_value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(class_name, key_value) ⇒ StorageKey
constructor
A new instance of StorageKey.
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(class_name, key_value) ⇒ StorageKey
Returns a new instance of StorageKey.
8 9 10 11 |
# File 'lib/lutaml/store/storage_key.rb', line 8 def initialize(class_name, key_value) @class_name = class_name.to_s @key_value = key_value.to_s end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
6 7 8 |
# File 'lib/lutaml/store/storage_key.rb', line 6 def class_name @class_name end |
#key_value ⇒ Object (readonly)
Returns the value of attribute key_value.
6 7 8 |
# File 'lib/lutaml/store/storage_key.rb', line 6 def key_value @key_value end |
Class Method Details
.parse(string) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/lutaml/store/storage_key.rb', line 19 def self.parse(string) str = string.to_s sep = str.rindex(/(?<!:):(?!:)/) return new("", str) unless sep new(str[0...sep], str[sep + 1..]) end |
Instance Method Details
#==(other) ⇒ Object
35 36 37 |
# File 'lib/lutaml/store/storage_key.rb', line 35 def ==(other) to_s == other.to_s end |
#eql?(other) ⇒ Boolean
27 28 29 |
# File 'lib/lutaml/store/storage_key.rb', line 27 def eql?(other) other.is_a?(StorageKey) && to_s == other.to_s end |
#hash ⇒ Object
31 32 33 |
# File 'lib/lutaml/store/storage_key.rb', line 31 def hash to_s.hash end |
#to_s ⇒ Object Also known as: to_str
13 14 15 |
# File 'lib/lutaml/store/storage_key.rb', line 13 def to_s "#{@class_name}:#{@key_value}" end |