lib/code/node/function_parameter.rb in code-ruby-0.13.1 vs lib/code/node/function_parameter.rb in code-ruby-0.14.0
- old
+ new
@@ -3,10 +3,11 @@
class Code
class Node
class FunctionParameter < Node
def initialize(parsed)
return if parsed.blank?
+
@name = parsed.delete(:name).presence
@keyword = parsed.delete(:keyword).present?
end
def name
@@ -29,9 +30,22 @@
false
end
def default
nil
+ end
+
+ def to_h
+ {
+ Object::String.new(:name) => Object::String.new(name),
+ Object::String.new(:regular?) => Object::Boolean.new(regular?),
+ Object::String.new(:keyword?) => Object::Boolean.new(keyword?),
+ Object::String.new(:regular_splat?) =>
+ Object::Boolean.new(regular_splat?),
+ Object::String.new(:keyword_splat?) =>
+ Object::Boolean.new(keyword_splat?),
+ Object::String.new(:default) => Object::Code.new(default)
+ }
end
end
end
end