Class: Match
- Inherits:
-
Object
- Object
- Match
- Defined in:
- lib/shooting_match_finder/match.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#entry_fee ⇒ Object
Returns the value of attribute entry_fee.
-
#location ⇒ Object
Returns the value of attribute location.
-
#match_start ⇒ Object
Returns the value of attribute match_start.
-
#match_url ⇒ Object
Returns the value of attribute match_url.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
-
.new_from_practiscore(match_array) ⇒ Object
Uses the hash array passed in by cli.rb to create matches.
- .show_matches ⇒ Object
Instance Method Summary collapse
-
#add_attributes(match_info) ⇒ Object
takes in a hash and uses mass assignment to add match details.
-
#initialize(match_hash) ⇒ Match
constructor
takes in a hash to assign each match a name and a url for later use in #add_attributes.
Constructor Details
#initialize(match_hash) ⇒ Match
takes in a hash to assign each match a name and a url for later use in #add_attributes.
7 8 9 10 |
# 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 |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
2 3 4 |
# File 'lib/shooting_match_finder/match.rb', line 2 def description @description end |
#entry_fee ⇒ Object
Returns the value of attribute entry_fee.
2 3 4 |
# File 'lib/shooting_match_finder/match.rb', line 2 def entry_fee @entry_fee end |
#location ⇒ Object
Returns the value of attribute location.
2 3 4 |
# File 'lib/shooting_match_finder/match.rb', line 2 def location @location end |
#match_start ⇒ Object
Returns the value of attribute match_start.
2 3 4 |
# File 'lib/shooting_match_finder/match.rb', line 2 def match_start @match_start end |
#match_url ⇒ Object
Returns the value of attribute match_url.
2 3 4 |
# File 'lib/shooting_match_finder/match.rb', line 2 def match_url @match_url end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/shooting_match_finder/match.rb', line 2 def name @name end |
Class Method Details
.new_from_practiscore(match_array) ⇒ Object
Uses the hash array passed in by cli.rb to create matches.
12 13 14 |
# 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 ⇒ Object
20 21 22 |
# File 'lib/shooting_match_finder/match.rb', line 20 def self.show_matches @@all end |
Instance Method Details
#add_attributes(match_info) ⇒ Object
takes in a hash and uses mass assignment to add match details.
16 17 18 |
# 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 |