Module: Herbert::ResourceLoader

Defined in:
lib/herbert/Resource.rb

Overview

Loads all Herberts’ resources

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object

Loads all application resources



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/herbert/Resource.rb', line 31

def self.registered(app)
			# Inject refence to the app into Resource
  Resource.class_eval do
define_singleton_method :app do
	app
end
			end			
			
			# And load all resource definitions
  path = File.join(app.settings.root, 'Resources')
  Dir.new(path).each do |file|
    next if %{. ..}.include? file
    require File.join(path,file)
  end
end