Class: Rubytypeformio::Link
Instance Attribute Summary collapse
-
#href ⇒ Object
Returns the value of attribute href.
-
#rel ⇒ Object
Returns the value of attribute rel.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rel, href) ⇒ Link
constructor
A new instance of Link.
- #to_h ⇒ Object
- #to_json ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(rel, href) ⇒ Link
Returns a new instance of Link.
9 10 11 12 |
# File 'lib/rubytypeformio/link.rb', line 9 def initialize (rel, href) @rel = rel @href = href end |
Instance Attribute Details
#href ⇒ Object
Returns the value of attribute href.
7 8 9 |
# File 'lib/rubytypeformio/link.rb', line 7 def href @href end |
#rel ⇒ Object
Returns the value of attribute rel.
7 8 9 |
# File 'lib/rubytypeformio/link.rb', line 7 def rel @rel end |
Class Method Details
.from_json(string) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rubytypeformio/link.rb', line 25 def self.from_json(string) data = JSON.load(string) obj = self.new( data["href"], data["rel"]) return obj end |
Instance Method Details
#to_h ⇒ Object
18 19 20 21 22 23 |
# File 'lib/rubytypeformio/link.rb', line 18 def to_h return { :href => @href, :rel => @rel } end |
#to_json ⇒ Object
14 15 16 |
# File 'lib/rubytypeformio/link.rb', line 14 def to_json JSON.dump(self.to_h) end |