Class: Holidays::Ar::Loader
- Inherits:
-
Object
- Object
- Holidays::Ar::Loader
- Defined in:
- lib/holidays/ar/loader.rb
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(year = Date.today.year) ⇒ Loader
constructor
A new instance of Loader.
Constructor Details
#initialize(year = Date.today.year) ⇒ Loader
Returns a new instance of Loader.
6 7 8 |
# File 'lib/holidays/ar/loader.rb', line 6 def initialize(year=Date.today.year) @year = year end |
Instance Method Details
#exec ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/holidays/ar/loader.rb', line 10 def exec holidays = [] doc.search('.mes').each_with_index do |mes, index| month = index + 1 mes.search('.bg-primary', '.bg-nl', '.bg-success').each do |day| holidays << Date.new(@year, month, day.text.to_i) end end holidays end |