class Match

Attributes

description[RW]
entry_fee[RW]
location[RW]
match_start[RW]
match_url[RW]
name[RW]

Public Class Methods

new(match_hash) click to toggle source
# File lib/shooting_match_finder/match.rb, line 7
def initialize(match_hash) #takes in a hash to assign each match a name and a url for later use in #add_attributes.
  match_hash.each {|key, value| self.send(("#{key}="), value)}
  @@all << self
end
new_from_practiscore(match_array) click to toggle source
# File lib/shooting_match_finder/match.rb, line 12
def self.new_from_practiscore(match_array) #Uses the hash array passed in by cli.rb to create matches.
  match_array.each{|match_hash| Match.new(match_hash)}
end
show_matches() click to toggle source
# File lib/shooting_match_finder/match.rb, line 20
def self.show_matches
  @@all
end

Public Instance Methods

add_attributes(match_info) click to toggle source
# File lib/shooting_match_finder/match.rb, line 16
def add_attributes(match_info) #takes in a hash and uses mass assignment to add match details.
  match_info.each {|key, value| self.send(("#{key}="), value)}
end