Module: Origen::Location::Map
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/origen/location/map.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/origen/location/map.rb', line 65 def method_missing(method, *args, &block) klass = self.class klass.constructed[method] || begin definition = klass.definitions[method] if definition defaults = klass.default_attributes[definition[:x]] || {} constructor = klass.constructors[definition[:x]] || klass.constructors[:default] if constructor instance = constructor.call(definition[:attributes], defaults) else instance = klass.default_constructor(definition[:attributes], defaults) end klass.constructed[method] = instance end end || super end |