lib/decode/language/ruby/method.rb in decode-0.7.0 vs lib/decode/language/ruby/method.rb in decode-0.8.0
- old
+ new
@@ -21,22 +21,28 @@
require_relative 'definition'
module Decode
module Language
module Ruby
+ # A Ruby-specific method.
class Method < Definition
+ # The short form of the method.
+ # e.g. `def puts`.
def short_form
@node.location.keyword.join(@node.location.name).source
end
+ # The node which contains the function arguments.
def arguments_node
if node = @node.children[1]
if node.location.expression
return node
end
end
end
+ # The long form of the method.
+ # e.g. `def puts(*lines, separator: "\n")`.
def long_form
if arguments_node = self.arguments_node
@node.location.keyword.join(
arguments_node.location.expression
).source
\ No newline at end of file