Class: TickTock::Punch

Inherits:
Object
  • Object
show all
Defined in:
lib/tick_tock/punch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaultObject



5
6
7
# File 'lib/tick_tock/punch.rb', line 5

def self.default
  with(time_now: Time.method(:now))
end

Instance Method Details

#card(subject: nil, parent_card: nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/tick_tock/punch.rb', line 9

def card(subject: nil, parent_card: nil)
  Card.with(
    subject: subject,
    parent_card: parent_card,
    time_in: nil,
    time_out: nil
  )
end

#in(card) ⇒ Object



18
19
20
# File 'lib/tick_tock/punch.rb', line 18

def in(card)
  card.with(time_in: time_now.call)
end

#out(card) ⇒ Object



22
23
24
# File 'lib/tick_tock/punch.rb', line 22

def out(card)
  card.with(time_out: time_now.call)
end

#parent_card_of(card) ⇒ Object



26
27
28
# File 'lib/tick_tock/punch.rb', line 26

def parent_card_of(card)
  card.parent_card
end