Class: Decode::Language::Ruby::Attribute

Inherits:
Definition
  • Object
show all
Defined in:
lib/decode/language/ruby/attribute.rb

Overview

A Ruby-specific attribute.

Instance Attribute Summary

Attributes inherited from Definition

#comments, #language, #name, #parent

Instance Method Summary collapse

Methods inherited from Definition

#container?, #convert, #documentation, #initialize, #multiline?, #nested?, #nested_name, #path, #qualified_form, #qualified_name, #start_with?, #text, #to_s

Constructor Details

This class inherits a constructor from Decode::Definition

Instance Method Details

#long_formObject



39
40
41
42
43
44
45
# File 'lib/decode/language/ruby/attribute.rb', line 39

def long_form
	if @node.location.line == @node.location.last_line
		@node.location.expression.source
	else
		short_form
	end
end

#short_formObject

The short form of the attribute. e.g. ‘attr :value`.



30
31
32
33
34
35
36
37
# File 'lib/decode/language/ruby/attribute.rb', line 30

def short_form
	case @node.type
	when :block
		"#{@name} { ... }"
	else
		@node.location.expression.source
	end
end