Class: GuidedPath::TextNode
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ TextNode
constructor
A new instance of TextNode.
- #to_hash ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ TextNode
Returns a new instance of TextNode.
9 10 11 12 13 14 15 |
# File 'lib/guided_path/text_node.rb', line 9 def initialize(args = {}) super args = args.symbolize_keys raise(ArgumentError, "Must specify a value for the node") unless args[:value] @value = args[:value].to_s end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/guided_path/text_node.rb', line 7 def value @value end |
Instance Method Details
#to_hash ⇒ Object
18 19 20 21 22 23 |
# File 'lib/guided_path/text_node.rb', line 18 def to_hash output = super output[:type] = 'text' output[:value] = @value output end |