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.
142 143 144 |
# File 'lib/tdl/exlib/itegration.rb', line 142 def initialize(itg:nil) @itg = itg end |
Instance Attribute Details
#silence_methods ⇒ Object (readonly)
Returns the value of attribute silence_methods.
141 142 143 |
# File 'lib/tdl/exlib/itegration.rb', line 141 def silence_methods @silence_methods end |
Instance Method Details
#def_var_func(name) ⇒ Object
188 189 190 191 192 |
# File 'lib/tdl/exlib/itegration.rb', line 188 def def_var_func(name) self.define_singleton_method(name) do instance_variable_get("@_#{name}") end end |
#define_active_behavior(name, *args, &block) ⇒ Object
201 202 203 |
# File 'lib/tdl/exlib/itegration.rb', line 201 def define_active_behavior(name,*args,&block) define_active_method(name,*args,&block) end |
#define_active_method(name, *args, &block) ⇒ Object
194 195 196 197 198 199 |
# File 'lib/tdl/exlib/itegration.rb', line 194 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
205 206 207 208 209 210 211 |
# File 'lib/tdl/exlib/itegration.rb', line 205 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
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/tdl/exlib/itegration.rb', line 171 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 |