Module: Appium::Twine

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

Constant Summary collapse

VERSION =
'0.0.1'
DATE =
'2014-08-14'

Class Method Summary collapse

Class Method Details

.add_formatter(formatter) ⇒ Object

Adds a single formatter to the Twine::Formatters constant.

Parameters:

  • formatter (Class)

    new formatter to append. Example: Formatters::Foobar



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

def add_formatter formatter
  target_module   = ::Twine::Formatters
  target_constant = :FORMATTERS

  return unless target_module.const_defined? target_constant

  old_value = target_module.send :remove_const, target_constant
  new_value = old_value << formatter

  target_module.send :const_set, target_constant, new_value
end