Class: ClosingComments::Commentable

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/closing_comments/commentable.rb

Direct Known Subclasses

Block, Class, Module

Defined Under Namespace

Classes: Block, Class, Module

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Commentable

Returns a new instance of Commentable.



11
12
13
# File 'lib/closing_comments/commentable.rb', line 11

def initialize(node)
  @node = node
end

Instance Method Details

#endingObject



23
24
25
# File 'lib/closing_comments/commentable.rb', line 23

def ending
  "end # #{entity} #{name}"
end

#nameObject



15
16
17
# File 'lib/closing_comments/commentable.rb', line 15

def name
  @name ||= name!(children.first)
end

#single_line?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/closing_comments/commentable.rb', line 19

def single_line?
  first_line == last_line
end