Module: DogFormatter::Model
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/dog_formatter/model.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *_args, &_block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dog_formatter/model.rb', line 8 def method_missing(method_name, *_args, &_block) method_name_suffix = matched_method_name_suffix(method_name.to_s) return unless method_name_suffix suffix_pattern = Regexp.new(method_name_suffix) attribute_name_except_format_value = method_name.to_s.sub!(suffix_pattern, '') return unless exist_column?(attribute_name_except_format_value) formatted_with_method_name_suffix(attribute_name_except_format_value, method_name_suffix) end |