Class: RBZK::Attendance
- Inherits:
-
Object
- Object
- RBZK::Attendance
- Defined in:
- lib/rbzk/attendance.rb
Instance Attribute Summary collapse
-
#punch ⇒ Object
Returns the value of attribute punch.
-
#status ⇒ Object
Returns the value of attribute status.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#uid ⇒ Object
Returns the value of attribute uid.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#check_in? ⇒ Boolean
Helper predicate for check-in (punch==0).
-
#check_out? ⇒ Boolean
Helper predicate for check-out (punch==1).
-
#initialize(user_id, timestamp, status, punch, uid) ⇒ Attendance
constructor
A new instance of Attendance.
-
#punch_name ⇒ Object
Human readable punch name (0=Check In, 1=Check Out).
- #to_s ⇒ Object
Constructor Details
#initialize(user_id, timestamp, status, punch, uid) ⇒ Attendance
Returns a new instance of Attendance.
7 8 9 10 11 12 13 |
# File 'lib/rbzk/attendance.rb', line 7 def initialize(user_id, , status, punch, uid) @user_id = user_id @timestamp = @status = status @punch = punch @uid = uid end |
Instance Attribute Details
#punch ⇒ Object
Returns the value of attribute punch.
5 6 7 |
# File 'lib/rbzk/attendance.rb', line 5 def punch @punch end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/rbzk/attendance.rb', line 5 def status @status end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/rbzk/attendance.rb', line 5 def @timestamp end |
#uid ⇒ Object
Returns the value of attribute uid.
5 6 7 |
# File 'lib/rbzk/attendance.rb', line 5 def uid @uid end |
#user_id ⇒ Object
Returns the value of attribute user_id.
5 6 7 |
# File 'lib/rbzk/attendance.rb', line 5 def user_id @user_id end |
Instance Method Details
#check_in? ⇒ Boolean
Helper predicate for check-in (punch==0)
16 17 18 |
# File 'lib/rbzk/attendance.rb', line 16 def check_in? @punch == 0 end |
#check_out? ⇒ Boolean
Helper predicate for check-out (punch==1)
21 22 23 |
# File 'lib/rbzk/attendance.rb', line 21 def check_out? @punch == 1 end |
#punch_name ⇒ Object
Human readable punch name (0=Check In, 1=Check Out)
26 27 28 29 30 31 32 |
# File 'lib/rbzk/attendance.rb', line 26 def punch_name case @punch when 0 then 'Check In' when 1 then 'Check Out' else "Punch (#{@punch})" end end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/rbzk/attendance.rb', line 34 def to_s "#{@user_id} #{@timestamp} #{@status} #{@punch} #{@uid}" end |