Class: Ruboty::Kintai::Reporters::Csv
- Inherits:
-
Object
- Object
- Ruboty::Kintai::Reporters::Csv
- Defined in:
- lib/ruboty/kintai/reporters/csv.rb
Instance Method Summary collapse
-
#initialize(kintai_range) ⇒ Csv
constructor
A new instance of Csv.
- #report ⇒ Object
Constructor Details
#initialize(kintai_range) ⇒ Csv
Returns a new instance of Csv.
5 6 7 |
# File 'lib/ruboty/kintai/reporters/csv.rb', line 5 def initialize(kintai_range) @kintai_range = kintai_range end |
Instance Method Details
#report ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruboty/kintai/reporters/csv.rb', line 9 def report CSV.generate do |csv| csv << %w(日付 名前 出勤 退勤) @kintai_range.each do |time, kintais| if kintais.empty? csv << [time.strftime("%Y-%m-%d"), "", "", ""] next end kintais.each do |name, kintai| csv << [time.strftime("%Y-%m-%d"), name, kintai[:go_work_at], kintai[:go_home_at]] end end end end |