Module: Junos::Ez::Provider
- Defined in:
- lib/junos-ez/provider.rb
Defined Under Namespace
Classes: Parent
Constant Summary collapse
- PROPERTIES =
all managed objects have the following properties:
[ :_exist, # exists in configuration (or should) :_active # active in configuration (or should) ]
Class Method Summary collapse
-
.attach_instance_variable(on_obj, varsname, new_obj) ⇒ Object
‘attach_instance_variable’ is the way to dynamically add an instance variable to the on_obj and “publish” it in the same way attr_accessor would.
Class Method Details
.attach_instance_variable(on_obj, varsname, new_obj) ⇒ Object
‘attach_instance_variable’ is the way to dynamically add an instance variable to the on_obj and “publish” it in the same way attr_accessor would.
60 61 62 63 64 65 66 67 |
# File 'lib/junos-ez/provider.rb', line 60 def self.attach_instance_variable( on_obj, varsname, new_obj ) ivar = ("@" + varsname.to_s).to_sym on_obj.instance_variable_set( ivar, new_obj ) on_obj.define_singleton_method( varsname ) do on_obj.instance_variable_get( ivar ) end on_obj.providers << varsname end |