Class: Decode::Language::Ruby::Attribute
- Inherits:
-
Definition
- Object
- Definition
- Decode::Language::Ruby::Attribute
- Defined in:
- lib/decode/language/ruby/attribute.rb
Overview
A Ruby-specific attribute.
Instance Attribute Summary
Attributes inherited from Definition
#The comment lines which directly preceeded the definition., #The language the symbol is defined within., #The path to the definition, relative to the parent., #The source file containing this definition., #comments, #language, #parent, #path, #source, #visibility
Instance Method Summary collapse
-
#long_form ⇒ Object
Generate a long form representation of the attribute.
-
#short_form ⇒ Object
The short form of the attribute.
Methods inherited from Definition
#:public, :private, :protected=, #The parent definition, defining lexical scope.=, #The symbol name e.g. `:Decode`.=, #container?, #convert, #coverage_relevant?, #documentation, #documented?, #full_path, #initialize, #inspect, #location, #multiline?, #name, #nested?, #nested_name, #public?, #qualified_form, #qualified_name, #start_with?, #text
Constructor Details
This class inherits a constructor from Decode::Definition
Instance Method Details
#long_form ⇒ Object
Generate a long form representation of the attribute.
25 26 27 28 29 30 31 |
# File 'lib/decode/language/ruby/attribute.rb', line 25 def long_form if @node&.location&.start_line == @node&.location&.end_line @node.location.slice else short_form end end |
#short_form ⇒ Object
The short form of the attribute. e.g. ‘attr :value`.
15 16 17 18 19 20 21 22 |
# File 'lib/decode/language/ruby/attribute.rb', line 15 def short_form case @node&.type when :block_node "#{@name} { ... }" else @node&.location&.slice || @name end end |