Sha256: 0cb2f189c72062f7c8a70ea2736d85b44d2f434616d4b85c8de2c98fa1eba4f5

Contents?: true

Size: 427 Bytes

Versions: 4

Compression:

Stored size: 427 Bytes

Contents

module SportsDataApi
  class MergedStats < JsonData
    def initialize(json, override_var_name = nil)
      super(json, override_var_name)
      ivar = instance_variable_get("@#{instance_var_name}")
      json.each do |key, val|
        next unless val.is_a? Hash
        json[key].each do |sub_key, data|
          ivar["#{key}_#{sub_key}".to_sym] = data
        end
        ivar.delete key.to_sym
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sports_data_api-0.15.0 lib/sports_data_api/merged_stats.rb
sports_data_api-0.14.1 lib/sports_data_api/merged_stats.rb
sports_data_api-0.14.0 lib/sports_data_api/merged_stats.rb
sports_data_api-0.13.0 lib/sports_data_api/merged_stats.rb