Module: Common::DefaultAttributeResolver
- Included in:
- NovaDsl::Provision
- Defined in:
- lib/common/attribute_resolver.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &script) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/common/attribute_resolver.rb', line 9 def method_missing (name, *args, &script) if args[0].nil? LOGGER.warn("Attribute '#{name}' is missing, no parameters specified when calling '#{name}' at #{self.class} instance, I'm gonna return 'nil'") nil else LOGGER.debug("Method '#{name}' missing, set new @#{name}: @#{name}=#{args[0]}") instance_variable_set("@#{name}".to_sym, args[0]) self.class.send(:define_method, name, proc { instance_variable_get("@#{name}") }) end end |