Class: Nitpick::Warnings::UnusedVariable

Inherits:
SimpleWarning show all
Defined in:
lib/nitpick/warnings/unused_variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SimpleWarning

discover, #matches?

Constructor Details

#initialize(variable) ⇒ UnusedVariable

Returns a new instance of UnusedVariable.



6
7
8
# File 'lib/nitpick/warnings/unused_variable.rb', line 6

def initialize(variable)
  @variable = variable
end

Instance Attribute Details

#variableObject (readonly)

Returns the value of attribute variable.



4
5
6
# File 'lib/nitpick/warnings/unused_variable.rb', line 4

def variable
  @variable
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/nitpick/warnings/unused_variable.rb', line 10

def ==(other)
  other.is_a?(self.class) && @variable == other.variable
end

#messageObject



14
15
16
# File 'lib/nitpick/warnings/unused_variable.rb', line 14

def message
  "The variable #{@variable.inspect} is unused."
end