Module: SchemaModel::ClassMethods
- Defined in:
- lib/utils/schema_model.rb
Instance Method Summary collapse
-
#schema(_name, opts = {}) ⇒ Object
Dynamically configures accessors, dirty tracking, validation, and serialization methods given definition in opts.
Instance Method Details
#schema(_name, opts = {}) ⇒ Object
Dynamically configures accessors, dirty tracking, validation, and serialization methods given definition in opts
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/utils/schema_model.rb', line 29 def schema(_name, opts = {}) define_method(:definition) { opts } opts.each do |k, definition| # Reader attr_reader k # Writer define_writer! k, definition end end |