Class: Japic::Match
- Inherits:
-
Object
- Object
- Japic::Match
- Defined in:
- lib/japic/match.rb
Constant Summary collapse
- MATCH_DATA_TYPES =
%w( date kickofftime home score away place note ).map(&:freeze).freeze
Instance Method Summary collapse
- #datetime ⇒ Object
-
#initialize(year, match_data) ⇒ Match
constructor
A new instance of Match.
Constructor Details
#initialize(year, match_data) ⇒ Match
Returns a new instance of Match.
15 16 17 18 19 20 |
# File 'lib/japic/match.rb', line 15 def initialize(year, match_data) @year = year match_data.each do |k, v| instance_variable_set(:"@#{k}", v) if MATCH_DATA_TYPES.include?(k) end end |
Instance Method Details
#datetime ⇒ Object
22 23 24 |
# File 'lib/japic/match.rb', line 22 def datetime @datetime ||= DateTime.parse("#{@year}/#{@date} #{@kickofftime} JST") end |