Class: Wlog::MakeCsv
- Inherits:
-
Commandable
- Object
- Commandable
- Wlog::MakeCsv
- Defined in:
- lib/wlog/commands/make_csv.rb
Overview
Instance Attribute Summary collapse
-
#ret ⇒ Object
Returns the value of attribute ret.
Instance Method Summary collapse
-
#execute ⇒ Object
TODO refactor me.
Instance Attribute Details
#ret ⇒ Object
Returns the value of attribute ret.
23 24 25 |
# File 'lib/wlog/commands/make_csv.rb', line 23 def ret @ret end |
Instance Method Details
#execute ⇒ Object
TODO refactor me. Because I feel like a horrible piece of code.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/wlog/commands/make_csv.rb', line 11 def execute str = "" LogEntry.all.group_by{|el| el.created_at.strftime("%Y-%m-%d")}.each_pair do |key,value| str.concat("#{value.first.created_at.strftime("%A")} #{key}\n") value.each do |entry| str.concat(",\"#{Helpers.break_string(entry.description,80)}\"#{$/}") end str.concat($/) end @ret = str end |