class BuiltinFunctions

Public Instance Methods

builtin_import(package) click to toggle source
# File lib/cli.rb, line 355
def builtin_import(package)
  attributes = {}
  require(package)
  for item in ObjectSpace.each_object
    begin
      item_name = String(item).downcase
    rescue Exception
      next
    end
    if package == item_name
      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