Module: UniverseCompiler::Entity::FieldManagement
- Included in:
- Base
- Defined in:
- lib/universe_compiler/entity/field_management.rb
Instance Attribute Summary collapse
-
#auto_create_fields ⇒ Object
Returns the value of attribute auto_create_fields.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/universe_compiler/entity/field_management.rb', line 8 def method_missing(method_name, *args) if auto_create_fields candidate_field_name = method_name method_name.to_s.match (/^(?<field_name>[^=]+)\s*=?$/) do |md| candidate_field_name = md['field_name'].to_sym end define_field_accessor candidate_field_name raise "Invalid method '#{method_name}' in #{self}" unless self.respond_to? method_name self.send method_name, *args else super(method_name, *args) end end |
Instance Attribute Details
#auto_create_fields ⇒ Object
Returns the value of attribute auto_create_fields.
6 7 8 |
# File 'lib/universe_compiler/entity/field_management.rb', line 6 def auto_create_fields @auto_create_fields end |