Class: SDM::Tag
- Inherits:
-
Object
- Object
- SDM::Tag
- Defined in:
- lib/models/porcelain.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name: nil, value: nil) ⇒ Tag
constructor
A new instance of Tag.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(name: nil, value: nil) ⇒ Tag
Returns a new instance of Tag.
6612 6613 6614 6615 6616 6617 6618 |
# File 'lib/models/porcelain.rb', line 6612 def initialize( name: nil, value: nil ) @name = name == nil ? "" : name @value = value == nil ? "" : value end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6608 6609 6610 |
# File 'lib/models/porcelain.rb', line 6608 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
6610 6611 6612 |
# File 'lib/models/porcelain.rb', line 6610 def value @value end |
Instance Method Details
#to_json(options = {}) ⇒ Object
6620 6621 6622 6623 6624 6625 6626 |
# File 'lib/models/porcelain.rb', line 6620 def to_json( = {}) hash = {} self.instance_variables.each do |var| hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var end hash.to_json end |