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.
8091 8092 8093 8094 8095 8096 8097 |
# File 'lib/models/porcelain.rb', line 8091 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.
8087 8088 8089 |
# File 'lib/models/porcelain.rb', line 8087 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
8089 8090 8091 |
# File 'lib/models/porcelain.rb', line 8089 def value @value end |
Instance Method Details
#to_json(options = {}) ⇒ Object
8099 8100 8101 8102 8103 8104 8105 |
# File 'lib/models/porcelain.rb', line 8099 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 |