class Decode::Language::Ruby::Method

A Ruby-specific method.

Public Instance Methods

arguments_node() click to toggle source

The node which contains the function arguments.

# File lib/decode/language/ruby/method.rb, line 35
def arguments_node
        if node = @node.children[1]
                if node.location.expression
                        return node
                end
        end
end
convert(kind) click to toggle source
Calls superclass method Decode::Definition#convert
# File lib/decode/language/ruby/method.rb, line 61
def convert(kind)
        case kind
        when :attribute
                Attribute.new(@node, @name,
                        comments: @comments, parent: @parent, language: @language
                )
        else
                super
        end
end
long_form() click to toggle source

The long form of the method. e.g. `def puts(*lines, separator: ā€œnā€)`.

# File lib/decode/language/ruby/method.rb, line 45
def long_form
        if arguments_node = self.arguments_node
                @node.location.keyword.join(
                        arguments_node.location.expression
                ).source
        else
                self.short_form
        end
end
qualified_form() click to toggle source

The fully qualified name of the block. e.g. `::Barnyard#foo`.

# File lib/decode/language/ruby/method.rb, line 57
def qualified_form
        self.qualified_name
end
short_form() click to toggle source

The short form of the method. e.g. `def puts`.

# File lib/decode/language/ruby/method.rb, line 30
def short_form
        @node.location.keyword.join(@node.location.name).source
end