Class: Mead::Container
- Inherits:
-
Object
- Object
- Mead::Container
- Defined in:
- lib/mead/container.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#label ⇒ Object
Returns the value of attribute label.
-
#text ⇒ Object
Returns the value of attribute text.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #==(another_container) ⇒ Object
-
#initialize(options = {}) ⇒ Container
constructor
A new instance of Container.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Container
Returns a new instance of Container.
5 6 7 8 9 10 |
# File 'lib/mead/container.rb', line 5 def initialize(={}) @type = [:type] @label = [:label] @identifier = [:identifier] @text = [:text] end |
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier.
3 4 5 |
# File 'lib/mead/container.rb', line 3 def identifier @identifier end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/mead/container.rb', line 3 def label @label end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/mead/container.rb', line 3 def text @text end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/mead/container.rb', line 3 def type @type end |
Instance Method Details
#==(another_container) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/mead/container.rb', line 12 def ==(another_container) self.identifier == another_container.identifier and self.type == another_container.type and self.label == another_container.label and self.text == another_container.text end |
#to_json(*a) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/mead/container.rb', line 19 def to_json(*a) h = { 'json_class' => self.class.name } self.instance_variables.each do |var| h[var.sub('@','').to_sym] = self.send(var.sub('@','').to_sym) end h.to_json(*a) end |