Class: JsonCanvas::FileNode
- Inherits:
-
GenericNode
- Object
- GenericNode
- JsonCanvas::FileNode
- Defined in:
- lib/json_canvas/node.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#subpath ⇒ Object
Returns the value of attribute subpath.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from GenericNode
#color, #height, #id, #width, #x, #y
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ FileNode
constructor
A new instance of FileNode.
- #to_hash ⇒ Object
Methods inherited from GenericNode
#default_height, #default_width, #to_hash_common
Constructor Details
#initialize(**kwargs) ⇒ FileNode
55 56 57 58 59 60 |
# File 'lib/json_canvas/node.rb', line 55 def initialize(**kwargs) super(**kwargs) @type = "file" @file = kwargs[:file] || "" @subpath = kwargs[:subpath] end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
53 54 55 |
# File 'lib/json_canvas/node.rb', line 53 def file @file end |
#subpath ⇒ Object
Returns the value of attribute subpath.
53 54 55 |
# File 'lib/json_canvas/node.rb', line 53 def subpath @subpath end |
#type ⇒ Object
Returns the value of attribute type.
53 54 55 |
# File 'lib/json_canvas/node.rb', line 53 def type @type end |
Instance Method Details
#to_hash ⇒ Object
62 63 64 65 66 67 |
# File 'lib/json_canvas/node.rb', line 62 def to_hash h = to_hash_common(type) h["file"] = file h["subpath"] = subpath if subpath h end |