Module: Nitpick::ClassMethods

Included in:
Nitpick, Nitpick
Defined in:
lib/nitpick.rb

Instance Method Summary collapse

Instance Method Details

#nitpick(value = nil) ⇒ Object

Use to manage nitpick message for debugging AutomateIt internals.

Arguments:

  • nil – Returns boolean of whether nitpick messages will be displayed.

  • Boolean – Sets nitpick state.

  • String or Symbol – Displays nitpick message if state is on.

Example:

nitpick true
nitpick "I'm nitpicking"


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/nitpick.rb', line 13

def nitpick(value=nil)
  case value
  when NilClass
    @nitpick
  when TrueClass, FalseClass
    @nitpick = value
  when String, Symbol
    puts "%% #{value}" if @nitpick
  else 
    raise TypeError.new("Unknown nitpick type: #{value.class}")
  end
end