Class: RuboCop::Cop::RSpec::UnusedLet::Scope::Definition

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubocop/cop/rspec/unused_let/scope.rb,
lib/rubocop/cop/rspec/unused_let/scope.rb,
sig/rubocop/cop/rspec/unused_let/scope.rbs,
sig/rubocop/cop/rspec/unused_let/scope.rbs

Overview

Reopened rather than given a Struct.new block, whose body rbs-inline does not read.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#helperObject

Returns the value of attribute helper

Returns:

  • (Object)

    the current value of helper



21
22
23
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 21

def helper
  @helper
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



21
22
23
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 21

def name
  @name
end

#namesObject

Returns the value of attribute names

Returns:

  • (Object)

    the current value of names



21
22
23
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 21

def names
  @names
end

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



21
22
23
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 21

def node
  @node
end

Class Method Details

.new(helper, name, names, node) ⇒ instance .new(helper:, name:, names:, node:) ⇒ instance

Overloads:

  • .new(helper, name, names, node) ⇒ instance

    Parameters:

    • helper (Symbol)
    • name (Symbol, nil)
    • names (Array[Symbol])
    • node (RuboCop::AST::Node)

    Returns:

    • (instance)
  • .new(helper:, name:, names:, node:) ⇒ instance

    Parameters:

    • helper: (Symbol)
    • name: (Symbol, nil)
    • names: (Array[Symbol])
    • node: (RuboCop::AST::Node)

    Returns:

    • (instance)


26
27
# File 'sig/rubocop/cop/rspec/unused_let/scope.rbs', line 26

def self.new: (?Symbol helper, ?Symbol? name, ?Array[Symbol] names, ?RuboCop::AST::Node node) -> instance
| (?helper: Symbol, ?name: Symbol?, ?names: Array[Symbol], ?node: RuboCop::AST::Node) -> instance

Instance Method Details

#anonymous?Boolean

Signature:

  • bool

Returns:

  • (Boolean)


43
44
45
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 43

def anonymous? #: bool
  name.nil?
end

#bang?Boolean

Signature:

  • bool

Returns:

  • (Boolean)


35
36
37
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 35

def bang? #: bool
  Matchers::BANG_HELPERS.include?(helper)
end

#def_helper?Boolean

Signature:

  • bool

Returns:

  • (Boolean)


39
40
41
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 39

def def_helper? #: bool
  helper == :def
end

#subject?Boolean

Signature:

  • bool

Returns:

  • (Boolean)


31
32
33
# File 'lib/rubocop/cop/rspec/unused_let/scope.rb', line 31

def subject? #: bool
  Matchers::SUBJECT_HELPERS.include?(helper)
end