Class: Import_Module::Source
- Defined in:
- lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb
Overview
kk
Instance Attribute Summary collapse
-
#methods ⇒ Object
readonly
Returns the value of attribute methods.
-
#mod ⇒ Object
readonly
Returns the value of attribute mod.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(mod) ⇒ Source
constructor
A new instance of Source.
- #inspect ⇒ Object
- #param(meth) ⇒ Object
- #param0(meth) ⇒ Object
Constructor Details
#initialize(mod) ⇒ Source
Returns a new instance of Source.
282 283 284 285 286 |
# File 'lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb', line 282 def initialize(mod) @mod = mod @methods = _methods store end |
Instance Attribute Details
#methods ⇒ Object (readonly)
Returns the value of attribute methods.
273 274 275 |
# File 'lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb', line 273 def methods @methods end |
#mod ⇒ Object (readonly)
Returns the value of attribute mod.
273 274 275 |
# File 'lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb', line 273 def mod @mod end |
Class Method Details
.enclose(mod) ⇒ Object
274 275 276 277 278 279 280 |
# File 'lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb', line 274 def self.enclose(mod) s = self mod.instance_eval do @__IMPORT_MODULE_PREFIX_source or @__IMPORT_MODULE_PREFIX_source = s.new(mod) end end |
Instance Method Details
#inspect ⇒ Object
288 289 290 |
# File 'lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb', line 288 def inspect "Source(#{@mod})" end |
#param(meth) ⇒ Object
292 293 294 295 296 297 298 299 300 301 |
# File 'lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb', line 292 def param(meth) s = "" if (n = @mod.instance_method(meth).arity) >= 0 n.times do |i| s << "x#{i}, " end s << "&b" else (-n-1).times do |i| s << "x#{i}, " end s << "*a, &b" end end |
#param0(meth) ⇒ Object
303 304 305 306 307 308 309 310 311 312 |
# File 'lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb', line 303 def param0(meth) s = "" if (n = @mod.instance_method(meth).arity) >= 0 n.times do |i| s << "x#{i}, " end s << "b" else (-n-1).times do |i| s << "x#{i}, " end s << "a, b" end end |