Exception: NaturalBornSlugger::IllegalOperationError

Inherits:
NaturalBornError
  • Object
show all
Defined in:
lib/natural_born_slugger/exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(class_name, method_name, context = nil) ⇒ IllegalOperationError

Returns a new instance of IllegalOperationError.



6
7
8
9
10
11
# File 'lib/natural_born_slugger/exceptions.rb', line 6

def initialize(class_name, method_name, context = nil)
  @class_name = class_name
  @method_name = method_name
  @context = context
  @message = "Cannot call `#{class_name}.#{method_name}"
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/natural_born_slugger/exceptions.rb', line 12

def to_s
  [@message, @context].compact.join(': ')+'.'
end