Module: Schema::Normalize::ClassMethods
- Defined in:
- lib/schema/normalize.rb
Instance Method Summary collapse
- #create_schema_model_normalizer ⇒ Object
- #normalize(attribute_name, method_name, options = {}) ⇒ Object
- #schema_model_normalizer ⇒ Object
- #schema_normalizations ⇒ Object
Instance Method Details
#create_schema_model_normalizer ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/schema/normalize.rb', line 15 def create_schema_model_normalizer normalizer = ::Schema::ModelNormalizer.new schema_normalizations.each do |(attribute_name, method_name, )| normalizer.add(attribute_name, method_name, ) end normalizer end |
#normalize(attribute_name, method_name, options = {}) ⇒ Object
27 28 29 30 |
# File 'lib/schema/normalize.rb', line 27 def normalize(attribute_name, method_name, = {}) new_value = schema_normalizations.dup << [attribute_name, method_name, ] redefine_class_method(:schema_normalizations, new_value) end |
#schema_model_normalizer ⇒ Object
23 24 25 |
# File 'lib/schema/normalize.rb', line 23 def schema_model_normalizer @schema_model_normalizer ||= create_schema_model_normalizer end |
#schema_normalizations ⇒ Object
11 12 13 |
# File 'lib/schema/normalize.rb', line 11 def schema_normalizations [].freeze end |