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