Module: Formattable::ClassMethods
- Defined in:
- lib/formattable.rb
Instance Method Summary collapse
Instance Method Details
#define_format_string(meth, options = {}, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/formattable.rb', line 5 def define_format_string(meth, = {}, &block) base_class = .fetch(:with) { StringFormatter } klass = formatter_class(base_class, block) set_formatter_for meth, klass define_formatter_method(meth) define_default_alias(meth) if [:default] end |
#formatter_for(meth) ⇒ Object
16 17 18 19 |
# File 'lib/formattable.rb', line 16 def formatter_for(meth) @formatters ||= {} @formatters[meth] end |