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.
6104 6105 6106 6107 6108 6109 6110 |
# File 'lib/models/porcelain.rb', line 6104 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.
6100 6101 6102 |
# File 'lib/models/porcelain.rb', line 6100 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
6102 6103 6104 |
# File 'lib/models/porcelain.rb', line 6102 def value @value end |
Instance Method Details
#to_json(options = {}) ⇒ Object
6112 6113 6114 6115 6116 6117 6118 |
# File 'lib/models/porcelain.rb', line 6112 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 |