Class: Interscript::Node::MetaData
- Inherits:
-
Interscript::Node
- Object
- Interscript::Node
- Interscript::Node::MetaData
- Defined in:
- lib/interscript/node/metadata.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](k) ⇒ Object
- #[]=(k, v) ⇒ Object
-
#initialize(data = {}) ⇒ MetaData
constructor
A new instance of MetaData.
- #reverse ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ MetaData
Returns a new instance of MetaData.
3 4 5 |
# File 'lib/interscript/node/metadata.rb', line 3 def initialize data={} @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
2 3 4 |
# File 'lib/interscript/node/metadata.rb', line 2 def data @data end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 |
# File 'lib/interscript/node/metadata.rb', line 20 def ==(other) super && self.data == other.data end |
#[](k) ⇒ Object
10 11 12 |
# File 'lib/interscript/node/metadata.rb', line 10 def [](k) @data[k] end |
#[]=(k, v) ⇒ Object
7 8 9 |
# File 'lib/interscript/node/metadata.rb', line 7 def []=(k,v) @data[k] = v end |
#reverse ⇒ Object
14 15 16 17 18 |
# File 'lib/interscript/node/metadata.rb', line 14 def reverse self.class.new(data.dup, **{}).tap do |rmd| rmd[:source_script], rmd[:destination_script] = rmd[:destination_script], rmd[:source_script] end end |
#to_hash ⇒ Object
24 25 26 27 |
# File 'lib/interscript/node/metadata.rb', line 24 def to_hash {:class => self.class.to_s, :data => @data} end |