lib/rooftop/base.rb in rooftop-0.0.5 vs lib/rooftop/base.rb in rooftop-0.0.6
- old
+ new
@@ -1,8 +1,10 @@
module Rooftop
module Base
def self.included(base)
+ @included_classes ||= []
+ @included_classes << base unless @included_classes.include?(base)
base.extend ClassMethods
base.include Her::Model
# Paths to get to the API
base.api_namespace = Rooftop::DEFAULT_API_NAMESPACE
@@ -35,10 +37,14 @@
# Set up the hooks identified in other mixins. This method is defined in Rooftop::HookCalls
base.send(:"setup_hooks!")
end
+ def self.included_classes
+ @included_classes
+ end
+
module ClassMethods
attr_reader :api_namespace, :api_version, :api_endpoint
def api_namespace=(ns)
@api_namespace = ns
@@ -56,9 +62,10 @@
end
def setup_path!
@api_endpoint ||= collection_path
self.collection_path "#{@api_namespace}/v#{@api_version}/#{@api_endpoint}"
+
end
# Allow calling 'first'
def first
all.first
\ No newline at end of file