module NumbersAndWords::Strategies::FiguresConverter::Decorators

Constants

AVAILABLE

Public Class Methods

factory(strategy, options) click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/decorators.rb, line 22
def factory(strategy, options)
  enabled_decorator(options).new strategy, options
end

Private Class Methods

decorator_class(method_name) click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/decorators.rb, line 32
def decorator_class(method_name)
  method_name ? Object.const_get(decorator_class_name(method_name)) : Decorators::Base
end
decorator_class_name(method_name) click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/decorators.rb, line 36
def decorator_class_name(method_name)
  "#{name}::#{I18n.language_class_name}::#{method_name.to_s.split('_').collect(&:capitalize).join}"
end
enabled_decorator(options) click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/decorators.rb, line 28
def enabled_decorator(options)
  decorator_class AVAILABLE.reject { |name| options[name].nil? }.first
end