Class: Achoo::Awake

Inherits:
Object
  • Object
show all
Defined in:
lib/achoo/awake.rb

Instance Method Summary collapse

Constructor Details

#initializeAwake

Returns a new instance of Awake.



9
10
11
12
13
# File 'lib/achoo/awake.rb', line 9

def initialize
  log = wtmp.merge!(suspend).reverse
  log.unshift(System::LogEntry.new(Time.now, :now))
  @sessions = sessions(log)
end

Instance Method Details

#allObject



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 = Temporal::Timespan.new(date, date+1)
  @sessions.each do |s|
    print_session(s, span) if s[0].overlaps?(span)
  end
end