ip2k / google-api-ruby-client

Automatically exported from code.google.com/p/google-api-ruby-client
Apache License 2.0
0 stars 0 forks source link

Schema.parse not working with Ruby 1.8.7 #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call Google::API::Schema.parse(...) 

What is the expected output? What do you see instead?
schema_class object is expected, but results in an exception that 
const_defined?(...) takes only one parameter.

What version of the product are you using? On what operating system?
I'm using Ruby 1.8.7 and in this version there is no const_defined?(...) and 
const_get(...) with 2 arguments for a module. These are of course available in 
Ruby 1.9.3.

Please provide any additional information below.
If this is the only issue to support Ruby 1.8.7 even if its old, than you can 
mayby insert just a small check in later releases of this gem.

I think a lot of projects still using Ruby 1.8.7 and in most cases its not 
trivial to upgrade.

Thank you!

For everybody with the same problem, a workaround:

class Module
    alias_method :orig_const_defined?, :const_defined?
    alias_method :orig_const_get, :const_get

    def const_defined?(sym, inherit=true)
      orig_const_defined?(sym)
    end

    def const_get(sym, inherit=true)
      orig_const_get(sym)
    end
end

Regards
Timo

Original issue reported on code.google.com by t...@meisterlabs.com on 18 Feb 2012 at 2:51

GoogleCodeExporter commented 9 years ago
Same problem here. This is not a valid reason to limit google-api-ruby-client 
to Ruby 1.9. Please do fix it.

Original comment by dusan.ma...@gmail.com on 22 Feb 2012 at 11:34

GoogleCodeExporter commented 9 years ago
Don't worry, I'm fixing it. :-)

Original comment by bobaman@google.com on 22 Feb 2012 at 11:52

GoogleCodeExporter commented 9 years ago

Original comment by bobaman@google.com on 22 Feb 2012 at 11:52

GoogleCodeExporter commented 9 years ago
That said, you should still upgrade. 1.8.7 is definitely still supported and 
will be for at least awhile yet, but at some point down the road, that will 
probably change.

Original comment by bobaman@google.com on 22 Feb 2012 at 11:54

GoogleCodeExporter commented 9 years ago
Resolved by 1632e98. Release coming shortly.

Original comment by bobaman@google.com on 22 Feb 2012 at 12:10

GoogleCodeExporter commented 9 years ago
0.4.2 Release should be live now.

Original comment by bobaman@google.com on 22 Feb 2012 at 12:48

GoogleCodeExporter commented 9 years ago
After updating to the new version 0.4.2 of your gem the issue is gone!

Thank you very much!

Original comment by t...@meisterlabs.com on 23 Feb 2012 at 9:55