Patch to solve Ruby 1.8.7 incompatibility.
[arvados.git] / lib / google / api_client / discovery / schema.rb
index f3499ebdc6112c26e1f9b36c3d275c9d65b4d2e1..cec0db8ccbc84975e322c6e020f08ff5471a522b 100644 (file)
@@ -74,22 +74,26 @@ module Google
             Google::INFLECTOR.camelize(api.name)
           api_version_string =
             Google::INFLECTOR.camelize(api.version).gsub('.', '_')
-          if Google::APIClient::Schema.const_defined?(api_name_string, false)
+          # This is for compatibility with Ruby 1.8.7.
+          # TODO(bobaman) Remove this when we eventually stop supporting 1.8.7.
+          args = []
+          args << false if Class.method(:const_defined?).arity != 1
+          if Google::APIClient::Schema.const_defined?(api_name_string, *args)
             api_name = Google::APIClient::Schema.const_get(
-              api_name_string, false
+              api_name_string, *args
             )
           else
             api_name = Google::APIClient::Schema.const_set(
               api_name_string, Module.new
             )
           end
-          if api_name.const_defined?(api_version_string, false)
-            api_version = api_name.const_get(api_version_string, false)
+          if api_name.const_defined?(api_version_string, *args)
+            api_version = api_name.const_get(api_version_string, *args)
           else
             api_version = api_name.const_set(api_version_string, Module.new)
           end
-          if api_version.const_defined?(schema_name, false)
-            schema_class = api_version.const_get(schema_name, false)
+          if api_version.const_defined?(schema_name, *args)
+            schema_class = api_version.const_get(schema_name, *args)
           end
         end