class Attribute < Definition

Inherits from
Definition: #public?, #protected?, #private?, #multiline?, #text, #location, #inspect, #name, #full_path, #coverage_relevant?, #documented?, #qualified_name, #nested_name, #start_with?, #convert, #qualified_form, #container?, #alias?, #nested?, #documentation

A Ruby-specific attribute.

Definitions

def short_form

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

Implementation

def short_form
	case @node&.type
	when :block_node
		"#{@name} { ... }"
	else
		@node&.location&.slice || @name
	end
end

def long_form

Generate a long form representation of the attribute.

Implementation

def long_form
	if @node&.location&.start_line == @node&.location&.end_line
		@node.location.slice
	else
		short_form
	end
end