Sha256: 98b862839ecc5bce680708a8a6d7630bdf27b0b5c7c8cf3a00caa679955881cf

Contents?: true

Size: 486 Bytes

Versions: 3

Compression:

Stored size: 486 Bytes

Contents

module NflData
  class Player
    ATTRIBUTES = [
      :first_name, :last_name, :full_name, :position, :number,
      :status, :team, :nfl_player_id, :picture_link, :profile_link
    ]

    attr_accessor(*ATTRIBUTES)

    def initialize(attributes = {})
      attributes.each { |attr, value| send("#{attr}=", value) }
    end

    def to_hash
      attributes_hash = {}
      ATTRIBUTES.each { |attr| attributes_hash.merge!(attr => send(attr)) }
      attributes_hash
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nfl_data-0.0.14 lib/nfl_data/models/player.rb
nfl_data-0.0.13 lib/nfl_data/models/player.rb
nfl_data-0.0.12 lib/nfl_data/models/player.rb