Permalink
Browse files

move models to pluralized folder

  • Loading branch information...
1 parent a535ad4 commit ed7abd8c6f0f74d8966255468afed1cc0ecb0179 @hollow hollow committed Nov 22, 2011
View
@@ -2,7 +2,7 @@
require "livestatus/version"
require "livestatus/connection"
-require "livestatus/model"
+require "livestatus/models"
module Livestatus
mattr_accessor :config
@@ -1,5 +0,0 @@
-require "livestatus/model/base"
-
-Dir["#{File.dirname(__FILE__)}/model/*.rb"].each do |path|
- require "livestatus/model/#{File.basename(path, '.rb')}"
-end
@@ -1,4 +1,9 @@
+require "active_support/core_ext"
+
module Livestatus
+ mattr_accessor :models
+ self.models = []
+
class Base
attr_reader :data
@@ -82,3 +87,11 @@ def check_type
end
end
end
+
+# load all models and register in Livestatus.models
+Dir["#{File.dirname(__FILE__)}/models/*.rb"].map do |path|
+ File.basename(path, '.rb')
+end.each do |name|
+ require "livestatus/models/#{name}"
+ Livestatus.models << "Livestatus::#{name.pluralize.classify}".constantize
+end
File renamed without changes.

0 comments on commit ed7abd8

Please sign in to comment.