Class: JsonCanvas::LinkNode
- Inherits:
-
GenericNode
- Object
- GenericNode
- JsonCanvas::LinkNode
- Defined in:
- lib/json_canvas/node.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from GenericNode
#color, #height, #id, #width, #x, #y
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ LinkNode
constructor
A new instance of LinkNode.
- #to_hash ⇒ Object
Methods inherited from GenericNode
#default_height, #default_width, #to_hash_common
Constructor Details
#initialize(**kwargs) ⇒ LinkNode
Returns a new instance of LinkNode.
73 74 75 76 77 |
# File 'lib/json_canvas/node.rb', line 73 def initialize(**kwargs) super(**kwargs) @type = "link" @url = kwargs[:url] || "https://www.ruby-lang.org" end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
71 72 73 |
# File 'lib/json_canvas/node.rb', line 71 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
71 72 73 |
# File 'lib/json_canvas/node.rb', line 71 def url @url end |
Instance Method Details
#to_hash ⇒ Object
79 80 81 82 83 |
# File 'lib/json_canvas/node.rb', line 79 def to_hash h = to_hash_common(type) h["url"] = url h end |