Class: ItgApi
- Inherits:
-
Object
- Object
- ItgApi
- Defined in:
- lib/tdl/exlib/itegration.rb
Instance Attribute Summary collapse
-
#silence_methods ⇒ Object
readonly
Returns the value of attribute silence_methods.
Instance Method Summary collapse
- #def_var_func(name) ⇒ Object
- #define_active_behavior(name, *args, &block) ⇒ Object
- #define_active_method(name, *args, &block) ⇒ Object
- #define_silence_behavior(name, bind_module, *args, &block) ⇒ Object
-
#initialize(itg: nil) ⇒ ItgApi
constructor
A new instance of ItgApi.
- #var(name, &block) ⇒ Object
Constructor Details
#initialize(itg: nil) ⇒ ItgApi
Returns a new instance of ItgApi.
144 145 146 |
# File 'lib/tdl/exlib/itegration.rb', line 144 def initialize(itg:nil) @itg = itg end |
Instance Attribute Details
#silence_methods ⇒ Object (readonly)
Returns the value of attribute silence_methods.
143 144 145 |
# File 'lib/tdl/exlib/itegration.rb', line 143 def silence_methods @silence_methods end |
Instance Method Details
#def_var_func(name) ⇒ Object
190 191 192 193 194 |
# File 'lib/tdl/exlib/itegration.rb', line 190 def def_var_func(name) self.define_singleton_method(name) do instance_variable_get("@_#{name}") end end |
#define_active_behavior(name, *args, &block) ⇒ Object
203 204 205 |
# File 'lib/tdl/exlib/itegration.rb', line 203 def define_active_behavior(name,*args,&block) define_active_method(name,*args,&block) end |
#define_active_method(name, *args, &block) ⇒ Object
196 197 198 199 200 201 |
# File 'lib/tdl/exlib/itegration.rb', line 196 def define_active_method(name,*args,&block) define_singleton_method(name) do instance_variable_set("@_#{name}_as_",true) block.call(*args) end end |
#define_silence_behavior(name, bind_module, *args, &block) ⇒ Object
207 208 209 210 211 212 213 |
# File 'lib/tdl/exlib/itegration.rb', line 207 def define_silence_behavior(name,bind_module,*args,&block) before_gen_sv_module_of(bind_module) do unless instance_variable_get("@_#{name}_as_") block.call(bind_module,*args) end end end |
#var(name, &block) ⇒ Object
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/tdl/exlib/itegration.rb', line 173 def var(name,&block) _var = instance_variable_get("@_#{name}") if name.to_s.eql? "req_inf" puts "#{self.to_s} IN IGT #{_var}" puts singleton_methods end if _var return _var else instance_variable_set("@_#{name}",block.call(self)) def_var_func(name) instance_variable_get("@_#{name}") end end |