Module: TryTo

Defined in:
lib/try_to.rb,
lib/try_to/version.rb

Constant Summary collapse

VERSION =
'1.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_handlerObject

Returns the value of attribute default_handler.



8
9
10
# File 'lib/try_to.rb', line 8

def default_handler
  @default_handler
end

.exceptionsObject (readonly)

Returns the value of attribute exceptions.



9
10
11
# File 'lib/try_to.rb', line 9

def exceptions
  @exceptions
end

.handlersObject (readonly)

Returns the value of attribute handlers.



9
10
11
# File 'lib/try_to.rb', line 9

def handlers
  @handlers
end

Class Method Details

.add_exception(exception) ⇒ Object



21
22
23
# File 'lib/try_to.rb', line 21

def add_exception(exception)
  @exceptions << exception
end

.add_handler(exception, handler) ⇒ Object



11
12
13
14
# File 'lib/try_to.rb', line 11

def add_handler(exception, handler)
  @handlers[exception] = handler
  @handlers
end

.remove_exception!(exception) ⇒ Object



25
26
27
# File 'lib/try_to.rb', line 25

def remove_exception!(exception)
  @exceptions -= [exception]
end

.remove_handler!(exception) ⇒ Object



16
17
18
19
# File 'lib/try_to.rb', line 16

def remove_handler!(exception)
  @handlers.delete(exception)
  @handlers
end

.reset_exceptions!Object



29
30
31
# File 'lib/try_to.rb', line 29

def reset_exceptions!
  @exceptions = [NoMethodError]
end