class Absinthe::Distillery::RootNamespace

Attributes

main[R]
root[R]

Public Class Methods

new(main) click to toggle source
# File lib/absinthe/distillery/root_namespace.rb, line 7
def initialize main
  @main = main
  @root = Module.new { extend self }
  main.include root
end

Public Instance Methods

load_file(file) click to toggle source
# File lib/absinthe/distillery/root_namespace.rb, line 17
def load_file file
  begin
    @root.send(:module_eval, file.read, file.path, 1)
  rescue Exception => ex
    puts "Failed to load #{file.path}: #{ex.message}"
    raise LoadFailed, ex
  end
end
register(name, value) click to toggle source
# File lib/absinthe/distillery/root_namespace.rb, line 13
def register name, value
  @root.send(:define_method, name) { value }
end