Class: SDM::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, value: nil) ⇒ Tag

Returns a new instance of Tag.



6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
# File 'lib/models/porcelain.rb', line 6701

def initialize(
  name: nil,
  value: nil
)
  if name != nil
    @name = name
  end
  if value != nil
    @value = value
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6697
6698
6699
# File 'lib/models/porcelain.rb', line 6697

def name
  @name
end

#valueObject

Returns the value of attribute value.



6699
6700
6701
# File 'lib/models/porcelain.rb', line 6699

def value
  @value
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6713
6714
6715
6716
6717
6718
6719
# File 'lib/models/porcelain.rb', line 6713

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end