Class: ActionFramework::Plugables

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

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Plugables

Returns a new instance of Plugables.



8
9
10
11
# File 'lib/actionframework/plugables.rb', line 8

def initialize &block
	@index = JSON.parse(File.read(Gem::Specification.find_lib_dir_by_name("actionframework")+"/plugables/index.json"))
	self.instance_eval &block
end

Instance Method Details

#plug(name) ⇒ Object



13
14
15
16
17
18
# File 'lib/actionframework/plugables.rb', line 13

def plug name
	if @index["plugs"].include? name
		require Gem::Specification.find_lib_dir_by_name("actionframework")+'/plugables/'+name
	end
	Object.const_get(name.classify).new if(Object.const_get(name.classify).superclass.to_s == "ActionFramework::Plugable::Initializer")
end