class Decode::Language::Ruby::Constant

A Ruby-specific constant.

Public Instance Methods

long_form() click to toggle source

The long form of the constant. e.g. `NAME = “Alice”`.

# File lib/decode/language/ruby/constant.rb, line 40
def long_form
        if @node.location.line == @node.location.last_line
                @node.location.expression.source
        elsif @node.children[2].type == :array
                "#{@name} = [...]"
        elsif @node.children[2].type == :hash
                "#{@name} = {...}"
        else
                self.short_form
        end
end
nested_name() click to toggle source
# File lib/decode/language/ruby/constant.rb, line 34
def nested_name
        "::#{@name}"
end
short_form() click to toggle source

The short form of the constant. e.g. `NAME`.

# File lib/decode/language/ruby/constant.rb, line 30
def short_form
        @node.location.name.source
end