Class: Rookout::Processor::Namespaces::ContainerNamespace
- Defined in:
- lib/rookout/processor/namespaces/container_namespace.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
- #call_method(name, args) ⇒ Object
- #dump(log_object_errors) ⇒ Object
-
#initialize(hash = {}) ⇒ ContainerNamespace
constructor
A new instance of ContainerNamespace.
- #read_attribute(name) ⇒ Object
- #write_attribute(name, value) ⇒ Object
Methods inherited from Namespace
Constructor Details
#initialize(hash = {}) ⇒ ContainerNamespace
Returns a new instance of ContainerNamespace.
13 14 15 16 |
# File 'lib/rookout/processor/namespaces/container_namespace.rb', line 13 def initialize hash = {} super() @hash = hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
18 19 20 |
# File 'lib/rookout/processor/namespaces/container_namespace.rb', line 18 def hash @hash end |
Instance Method Details
#call_method(name, args) ⇒ Object
21 22 23 24 |
# File 'lib/rookout/processor/namespaces/container_namespace.rb', line 21 def call_method name, args return RubyObjectNamespace.new @hash.length if name == "size" super end |
#dump(log_object_errors) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rookout/processor/namespaces/container_namespace.rb', line 35 def dump log_object_errors variant = Com::Rookout::Variant.new variant_type: :VARIANT_NAMESPACE, namespace_value: Com::Rookout::Variant::Namespace.new @hash.each do |key, value| dumped_value = value.dump log_object_errors namespace = Com::Rookout::Variant::NamedValue.new name: key, value: dumped_value variant.namespace_value.attributes << namespace end variant end |
#read_attribute(name) ⇒ Object
26 27 28 29 |
# File 'lib/rookout/processor/namespaces/container_namespace.rb', line 26 def read_attribute name raise Exceptions::RookAttributeNotFound, name unless @hash.key? name @hash[name] end |
#write_attribute(name, value) ⇒ Object
31 32 33 |
# File 'lib/rookout/processor/namespaces/container_namespace.rb', line 31 def write_attribute name, value @hash[name] = value end |