Class: AsyncStorage::Naming
- Inherits:
-
Object
- Object
- AsyncStorage::Naming
- Includes:
- Util::Strings
- Defined in:
- lib/async_storage/naming.rb
Constant Summary collapse
- SET =
{ head: 'h', body: 'b', none: '_null_', }.freeze
Instance Attribute Summary collapse
-
#class_args ⇒ Object
readonly
Returns the value of attribute class_args.
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Instance Method Summary collapse
- #body ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #head ⇒ Object
-
#initialize(klass, *args) ⇒ Naming
constructor
A new instance of Naming.
- #to_s ⇒ Object
Methods included from Util::Strings
Constructor Details
#initialize(klass, *args) ⇒ Naming
Returns a new instance of Naming.
20 21 22 23 |
# File 'lib/async_storage/naming.rb', line 20 def initialize(klass, *args) @class_name = normalize_class(klass.name) @class_args = normalize_args(args) end |
Instance Attribute Details
#class_args ⇒ Object (readonly)
Returns the value of attribute class_args.
17 18 19 |
# File 'lib/async_storage/naming.rb', line 17 def class_args @class_args end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
17 18 19 |
# File 'lib/async_storage/naming.rb', line 17 def class_name @class_name end |
#prefix ⇒ Object
Returns the value of attribute prefix.
18 19 20 |
# File 'lib/async_storage/naming.rb', line 18 def prefix @prefix end |
Instance Method Details
#body ⇒ Object
29 30 31 |
# File 'lib/async_storage/naming.rb', line 29 def body "#{base}:#{SET[:body]}" end |
#eql?(other) ⇒ Boolean Also known as: ==
41 42 43 44 45 |
# File 'lib/async_storage/naming.rb', line 41 def eql?(other) return false unless other.is_a?(self.class) [head, body] == [other.head, other.body] end |
#head ⇒ Object
25 26 27 |
# File 'lib/async_storage/naming.rb', line 25 def head "#{base}:#{SET[:head]}" end |
#to_s ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/async_storage/naming.rb', line 33 def to_s format( '#<AsyncStorage::Naming head=%<head>p body=%<body>p>', head: head, body: body, ) end |