Method: Parser::AST::Node#to_value
- Defined in:
- lib/synvert/core/node_ext.rb
#to_value ⇒ Object
Return the exact value of node. It supports :array, :begin, :erange, :false, :float, :irange, :int, :str, :sym and :true nodes.
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/synvert/core/node_ext.rb', line 250 def to_value case type when :int, :float, :str, :sym children.last when :true true when :false false when :nil nil when :array children.map(&:to_value) when :irange (children.first.to_value..children.last.to_value) when :erange (children.first.to_value...children.last.to_value) when :begin children.first.to_value else self end end |