Class: Achoo::Awake
- Inherits:
-
Object
- Object
- Achoo::Awake
- Defined in:
- lib/achoo/awake.rb
Instance Method Summary collapse
- #all ⇒ Object
- #at(date) ⇒ Object
-
#initialize ⇒ Awake
constructor
A new instance of Awake.
Constructor Details
#initialize ⇒ Awake
Returns a new instance of Awake.
9 10 11 12 13 |
# File 'lib/achoo/awake.rb', line 9 def initialize log = array_merge(wtmp, suspend) {|a, b| a[0] >= b[0] } log.unshift([Time.now, :now]) @sessions = sessions(log) end |
Instance Method Details
#all ⇒ Object
22 23 24 25 26 |
# File 'lib/achoo/awake.rb', line 22 def all @sessions.each do |s| print_session(s) end end |
#at(date) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/achoo/awake.rb', line 15 def at(date) span = Achoo::Timespan.new(date, date+1) @sessions.each do |s| print_session(s, span) if s[0].overlaps?(span) end end |