Class: AsyncStorage::Naming
- Inherits:
-
Object
- Object
- AsyncStorage::Naming
- Includes:
- Util::Strings
- Defined in:
- lib/async_storage/naming.rb
Constant Summary collapse
- SET =
{ temp: 't', 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.
- #temp ⇒ Object
- #to_s ⇒ Object
Methods included from Util::Strings
Constructor Details
#initialize(klass, *args) ⇒ Naming
Returns a new instance of Naming.
21 22 23 24 |
# File 'lib/async_storage/naming.rb', line 21 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.
18 19 20 |
# File 'lib/async_storage/naming.rb', line 18 def class_args @class_args end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
18 19 20 |
# File 'lib/async_storage/naming.rb', line 18 def class_name @class_name end |
#prefix ⇒ Object
Returns the value of attribute prefix.
19 20 21 |
# File 'lib/async_storage/naming.rb', line 19 def prefix @prefix end |
Instance Method Details
#body ⇒ Object
34 35 36 |
# File 'lib/async_storage/naming.rb', line 34 def body "#{base}:#{SET[:body]}" end |
#eql?(other) ⇒ Boolean Also known as: ==
46 47 48 49 50 |
# File 'lib/async_storage/naming.rb', line 46 def eql?(other) return false unless other.is_a?(self.class) [head, body] == [other.head, other.body] end |
#head ⇒ Object
30 31 32 |
# File 'lib/async_storage/naming.rb', line 30 def head "#{base}:#{SET[:head]}" end |
#temp ⇒ Object
26 27 28 |
# File 'lib/async_storage/naming.rb', line 26 def temp "#{base}:#{SET[:temp]}" end |
#to_s ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/async_storage/naming.rb', line 38 def to_s format( '#<AsyncStorage::Naming head=%<head>p body=%<body>p>', head: head, body: body, ) end |