class Transmogrifier::ValueNode
Attributes
parent_node[R]
Public Class Methods
new(value, parent_node=nil)
click to toggle source
# File lib/transmogrifier/nodes/value_node.rb, line 7 def initialize(value, parent_node=nil) @value = value @parent_node = parent_node end
Public Instance Methods
find_all(keys)
click to toggle source
# File lib/transmogrifier/nodes/value_node.rb, line 12 def find_all(keys) return [self] if keys.empty? raise "cannot find children of ValueNode satisfying non-empty selector #{keys}" end
modify(pattern, replacement)
click to toggle source
# File lib/transmogrifier/nodes/value_node.rb, line 17 def modify(pattern, replacement) raise "Value is not modifiable using pattern matching" unless @value.respond_to?(:gsub) return @value.gsub!(Regexp.new(pattern), replacement) end
raw()
click to toggle source
# File lib/transmogrifier/nodes/value_node.rb, line 22 def raw @value end