Class: BuiltinFunctions

Inherits:
Object
  • Object
show all
Defined in:
lib/cli.rb

Instance Method Summary collapse

Instance Method Details

#builtin_import(package) ⇒ Object



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/cli.rb', line 341

def builtin_import(package)
  attributes = {}
  require(package)
  for item in ObjectSpace.each_object
    if package == String(item).downcase
      begin
        scope = Kernel.const_get(item)
      rescue Exception
        next
      end
      for name in scope.constants
        attributes[String(name)] = scope.const_get(name)
      end
    end
  end
  return attributes
end