Class: Manic::Config

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/manic/config.rb', line 12

def method_missing(meth, *args)
	  isproc = args[0].is_a?(Proc)
  if isproc
    Config.send(:define_method, meth, args[0])
  else
 Config.class_eval "def Base.#{meth}; @#{meth}; end; def Base.#{meth}=(var); @#{meth} = var; end; Base.#{meth} = \"#{args[0]}\""
  end	  
 
end

Instance Method Details

#plugin(file) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/manic/config.rb', line 4

def plugin(file)
  if file.is_a?(String)
    require(file)
  else
    Base.extend(file)
  end
end