Sha256: f989fb2ccc113ee4e8b65e08327426d75a685dc3d3ace8e5016c6e326b519cec

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

require 'lol/model'

module Lol
  class ChampionStatisticsSummary < Lol::Model
    # @!attribute [r] id
    #   @return [Fixnum] Champion Id
    attr_reader :id

    # @!attribute [r] name
    #   @return [String] Champion Name
    attr_reader :name

    # @!attribute [r] stats
    #   @return [Array] List of stats associated with this champion
    attr_reader :stats

    private

    attr_writer :id, :name

    def stats= value
      @stats = value.is_a?(Hash) && OpenStruct.new(underscore_hash_keys value) || value
    end

    def underscore_hash_keys hash
      hash.inject({}) { |memo, (key, value)| memo.update key.to_s.underscore => value }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-lol-0.9.4 lib/lol/champion_statistics_summary.rb
ruby-lol-0.9.3 lib/lol/champion_statistics_summary.rb