Class: Riak::Crdt::InnerMap
Overview
A map that exists inside a TypedCollection inside another map.
Instance Attribute Summary collapse
-
#counters ⇒ Object
readonly
Returns the value of attribute counters.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#maps ⇒ Object
readonly
Returns the value of attribute maps.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
private
The parent of this counter.
-
#registers ⇒ Object
readonly
Returns the value of attribute registers.
-
#sets ⇒ Object
readonly
Returns the value of attribute sets.
Class Method Summary collapse
- .delete ⇒ Object private
Instance Method Summary collapse
- #context? ⇒ Boolean
-
#initialize(parent, value = {}) ⇒ InnerMap
constructor
private
A new instance of InnerMap.
- #operate(inner_operation) ⇒ Object private
- #pretty_print(pp) ⇒ Object
- #pretty_print_cycle(pp) ⇒ Object
- #to_value_h ⇒ Object (also: #value)
Constructor Details
#initialize(parent, value = {}) ⇒ InnerMap
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of InnerMap.
15 16 17 18 19 20 |
# File 'lib/riak/crdt/inner_map.rb', line 15 def initialize(parent, value = {}) @parent = parent @value = value.symbolize_keys initialize_collections end |
Instance Attribute Details
#counters ⇒ Object (readonly)
Returns the value of attribute counters.
5 6 7 |
# File 'lib/riak/crdt/inner_map.rb', line 5 def counters @counters end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
5 6 7 |
# File 'lib/riak/crdt/inner_map.rb', line 5 def flags @flags end |
#maps ⇒ Object (readonly)
Returns the value of attribute maps.
5 6 7 |
# File 'lib/riak/crdt/inner_map.rb', line 5 def maps @maps end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/riak/crdt/inner_map.rb', line 7 def name @name end |
#parent ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The parent of this counter.
12 13 14 |
# File 'lib/riak/crdt/inner_map.rb', line 12 def parent @parent end |
#registers ⇒ Object (readonly)
Returns the value of attribute registers.
5 6 7 |
# File 'lib/riak/crdt/inner_map.rb', line 5 def registers @registers end |
#sets ⇒ Object (readonly)
Returns the value of attribute sets.
5 6 7 |
# File 'lib/riak/crdt/inner_map.rb', line 5 def sets @sets end |
Class Method Details
Instance Method Details
#context? ⇒ Boolean
61 62 63 |
# File 'lib/riak/crdt/inner_map.rb', line 61 def context? @parent.context? end |
#operate(inner_operation) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 27 28 29 30 |
# File 'lib/riak/crdt/inner_map.rb', line 23 def operate(inner_operation) wrapped_operation = Operation::Update.new.tap do |op| op.value = inner_operation op.type = :map end @parent.operate(name, wrapped_operation) end |
#pretty_print(pp) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/riak/crdt/inner_map.rb', line 32 def pretty_print(pp) pp.object_group self do %w{counters flags maps registers sets}.each do |h| pp.comma_breakable pp.text "#{h}=" pp.pp send h end end end |
#pretty_print_cycle(pp) ⇒ Object
42 43 44 |
# File 'lib/riak/crdt/inner_map.rb', line 42 def pretty_print_cycle(pp) pp.text "InnerMap" end |
#to_value_h ⇒ Object Also known as: value
46 47 48 49 50 |
# File 'lib/riak/crdt/inner_map.rb', line 46 def to_value_h %w{counters flags maps registers sets}.map do |k| [k, send(k).to_value_h] end.to_h end |