Sha256: 42d98634bb01bb2d3d431e37589fbef0db9477baa93c70e52b13dc6da42144f7

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 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

1 entries across 1 versions & 1 rubygems

Version Path
ruby-lol-0.9.5 lib/lol/champion_statistics_summary.rb