Class: Import_Module::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb

Overview

kk

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#methodsObject (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

#modObject (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

#inspectObject



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