class ClosingComments::Commentable::Block

Constants

RSPEC

Public Instance Methods

commentable?() click to toggle source
# File lib/closing_comments/commentable.rb, line 59
def commentable?
  dispatch.type == :send && rspec?
end
entity() click to toggle source
# File lib/closing_comments/commentable.rb, line 67
def entity
  return message if implicit_receiver?
  [name!(receiver), message].join('.')
end
name() click to toggle source
# File lib/closing_comments/commentable.rb, line 63
def name
  name!(dispatch.children[2])
end

Private Instance Methods

dispatch() click to toggle source
# File lib/closing_comments/commentable.rb, line 79
def dispatch
  children.first
end
implicit_receiver?() click to toggle source

This method reeks of :reek:NilCheck.

# File lib/closing_comments/commentable.rb, line 88
def implicit_receiver?
  receiver.nil?
end
message() click to toggle source
# File lib/closing_comments/commentable.rb, line 92
def message
  dispatch.children[1]
end
receiver() click to toggle source
# File lib/closing_comments/commentable.rb, line 83
def receiver
  dispatch.children.first
end
rspec?() click to toggle source
# File lib/closing_comments/commentable.rb, line 74
def rspec?
  return false unless implicit_receiver? || name!(receiver) == :RSpec
  RSPEC.include?(message)
end