Class: RuboCounsel::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocounsel/example.rb

Overview

Represents a parsed @example tag from RuboCop cop documentation.

Example names in RuboCop follow patterns like:

"EnforcedStyle: single_quotes (default)"
"EnforcedStyle: double_quotes"
"EnforcedStyleForLeadingUnderscores :optional"  (inconsistent spacing)
"Using splat expansion"  (no attribute/value)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yard_example) ⇒ Example

Returns a new instance of Example.



14
15
16
17
18
19
# File 'lib/rubocounsel/example.rb', line 14

def initialize(yard_example)
  @name = yard_example.name
  @text = yard_example.text

  parse_name
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



12
13
14
# File 'lib/rubocounsel/example.rb', line 12

def attribute
  @attribute
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/rubocounsel/example.rb', line 12

def name
  @name
end

#textObject (readonly)

Returns the value of attribute text.



12
13
14
# File 'lib/rubocounsel/example.rb', line 12

def text
  @text
end

#valueObject (readonly)

Returns the value of attribute value.



12
13
14
# File 'lib/rubocounsel/example.rb', line 12

def value
  @value
end

Instance Method Details

#default?Boolean

Returns:



21
22
23
# File 'lib/rubocounsel/example.rb', line 21

def default?
  @default
end