Sha256: 1dda48348103552c5cd379df5781e6a780ffc77dff91879dc4c2db98b3f62d13
Contents?: true
Size: 736 Bytes
Versions: 1
Compression:
Stored size: 736 Bytes
Contents
module OData # Helper methods class Helpers # Helper to normalize the results of a select result; Ruby 1.9 Hash.select returns a Hash, 1.8 returns an Array # This is for Ruby 1.8 support, but should be removed in the future def self.normalize_to_hash(val) return nil if val.nil? (val.is_a? Hash) ? val : Hash[*val.flatten] end # Wrapper for URI escaping that switches between URI::Parser#escape and # URI.escape for 1.9-compatibility (thanks FakeWeb https://github.com/chrisk/fakeweb/blob/master/lib/fake_web/utility.rb#L40) def self.uri_escape(*args) if URI.const_defined?(:Parser) URI::Parser.new.escape(*args) else URI.escape(*args) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_odata-0.1.1 | lib/ruby_odata/helpers.rb |