Explorar el Código

conditionally include threadsafe hack

Peter McCracken hace 11 años
padre
commit
c03a4cc396
Se han modificado 1 ficheros con 19 adiciones y 7 borrados
  1. 19 7
      lib/shopify_api/resources/base.rb

+ 19 - 7
lib/shopify_api/resources/base.rb

@@ -26,13 +26,25 @@ module ShopifyAPI
     end
     end
 
 
     class << self
     class << self
-      def headers
-        if _headers_defined?
-          _headers
-        elsif superclass != Object && superclass.headers
-          superclass.headers
-        else
-          _headers ||= {}
+      if ActiveResource::VERSION::MAJOR == 4 && ActiveResource::VERSION::PRE == 'threadsafe'
+        def headers
+          if _headers_defined?
+            _headers
+          elsif superclass != Object && superclass.headers
+            superclass.headers
+          else
+            _headers ||= {}
+          end
+        end
+      else
+        def headers
+          if defined?(@headers)
+            @headers
+          elsif superclass != Object && superclass.headers
+            superclass.headers
+          else
+            @headers ||= {}
+          end
         end
         end
       end
       end