Method: Require.method_missing

Defined in:
lib/require.rb

.method_missing(method, value = nil, options = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/require.rb', line 36

def method_missing(method, value=nil, options=nil)
  method = method.to_s
  if method.include?('!')
    method = method.gsub!('!', '').intern
    gem = get(:gem, method)
    profile = get(method)
    if profile
      profile.dsl.each do |dsl|
        if dsl.gem?
          require_gem! dsl.name, dsl.version, dsl.dsl
        elsif dsl.load_path?
          load_path! dsl.path
        elsif dsl.require?
          require! dsl.path
        end
      end
    elsif gem
      require_gem! gem.name
    end
  else
    raise "Require##{method} does not exist"
  end
end