module MaybeYouMeant::Config

Public Class Methods

add_to_history() click to toggle source
# File lib/maybeyoumeant/config.rb, line 42
def self.add_to_history
  @add_to_history
end
add_to_history=(enabled) click to toggle source

When true and a nearby method is called the history is manipulated to have the nearby method name. Defaults to true. This is done with a simple search and replace and may not be perfect, especially for short methods. Say object foo has a method 'foob' you will get the following in your history: foo.foo -> foob.foob

# File lib/maybeyoumeant/config.rb, line 38
def self.add_to_history=(enabled)
  @add_to_history = true
end
ask_user() click to toggle source
# File lib/maybeyoumeant/config.rb, line 68
def self.ask_user
  @ask_user
end
ask_user=(enabled) click to toggle source

When true, the nearby method is not called directly, but the user can decide if he wants to call it Defaults to false

# File lib/maybeyoumeant/config.rb, line 64
def self.ask_user=(enabled)
  @ask_user = enabled
end
call_nearby() click to toggle source
# File lib/maybeyoumeant/config.rb, line 26
def self.call_nearby
  @call_nearby
end
call_nearby=(enabled) click to toggle source

When true if a nearby method is found it is automatically called. Defaults to true.

# File lib/maybeyoumeant/config.rb, line 22
def self.call_nearby=(enabled)
  @call_nearby = enabled
end
debug() click to toggle source

Indicates if debug logger is currently enabled.

# File lib/maybeyoumeant/config.rb, line 14
def self.debug
  MaybeYouMeant::StdErrLogger === MaybeYouMeant.logger
end
debug=(enabled) click to toggle source

Set to true to log when a nearby message is automatically called. Default value is true.

# File lib/maybeyoumeant/config.rb, line 4
def self.debug=(enabled)
  raise 'Debug can only be set to true or false.' unless enabled == true || enabled == false
  if enabled
    MaybeYouMeant.logger = MaybeYouMeant::StdErrLogger.new
  else
    MaybeYouMeant.logger = MaybeYouMeant::NilLogger.new
  end
end
remove_from_history(enabled) click to toggle source

When true and a nearby method is called the history is manipulated to have the line with the incorrect method name removed. Defaults to false.

# File lib/maybeyoumeant/config.rb, line 51
def self.remove_from_history(enabled)
  @remove_from_history = enabled
end