Sha256: 5970a42cbfadf8b41074bb7c490e8fdcea2f8d94e979b03dcde0a9ccde2a7ea3

Contents?: true

Size: 503 Bytes

Versions: 71

Compression:

Stored size: 503 Bytes

Contents

module SparkApi
  # Used for API client options that accept string keys instead of symbols -- 
  # turns all symbol keys into a string for consistancy, allowing applications
  # using the client to pass in parameters as symbols or strings.
  class OptionsHash < Hash 
    def initialize(from_hash={})
      from_hash.keys.each do |k|
        if k.is_a?(Symbol)
          self[k.to_s] = from_hash[k] 
        else
          self[k] = from_hash[k] 
        end
      end
      self
    end
  end
end
    

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
spark_api-2.0.0 lib/spark_api/options_hash.rb
spark_api-1.6.3 lib/spark_api/options_hash.rb
spark_api-1.6.2 lib/spark_api/options_hash.rb
spark_api-1.6.1 lib/spark_api/options_hash.rb
spark_api-1.5.7 lib/spark_api/options_hash.rb
spark_api-1.6.0 lib/spark_api/options_hash.rb
spark_api-1.5.6 lib/spark_api/options_hash.rb
spark_api-1.5.5 lib/spark_api/options_hash.rb
spark_api-1.5.4 lib/spark_api/options_hash.rb
spark_api-1.5.3 lib/spark_api/options_hash.rb
spark_api-1.5.2 lib/spark_api/options_hash.rb
spark_api-1.5.1 lib/spark_api/options_hash.rb
spark_api-1.5.0 lib/spark_api/options_hash.rb
spark_api-1.4.34 lib/spark_api/options_hash.rb
spark_api-1.4.32 lib/spark_api/options_hash.rb
spark_api-1.4.31 lib/spark_api/options_hash.rb
spark_api-1.4.29 lib/spark_api/options_hash.rb
spark_api-1.4.28 lib/spark_api/options_hash.rb
spark_api-1.4.27 lib/spark_api/options_hash.rb
spark_api-1.4.26 lib/spark_api/options_hash.rb