Class: CheckIn::Reader
- Inherits:
-
Object
- Object
- CheckIn::Reader
- Defined in:
- lib/check_in/reader.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Instance Method Summary collapse
- #check_in_configuration ⇒ Object
- #checkins ⇒ Object
-
#initialize(base) ⇒ Reader
constructor
A new instance of Reader.
- #raw_checkins ⇒ Object
Constructor Details
#initialize(base) ⇒ Reader
Returns a new instance of Reader.
4 5 6 |
# File 'lib/check_in/reader.rb', line 4 def initialize(base) @base = base end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
3 4 5 |
# File 'lib/check_in/reader.rb', line 3 def base @base end |
Instance Method Details
#check_in_configuration ⇒ Object
22 23 24 |
# File 'lib/check_in/reader.rb', line 22 def check_in_configuration base.check_in_configuration end |
#checkins ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/check_in/reader.rb', line 12 def checkins raw_checkins.collect do |c| value, time = c.split(" | ") { :value => value, :time => Time.parse(time) } end.sort{ |a, b| a[:time] <=> b[:time] } end |
#raw_checkins ⇒ Object
8 9 10 |
# File 'lib/check_in/reader.rb', line 8 def raw_checkins CheckIn.redis.lrange(check_in_configuration.redis_key, 0, check_in_configuration.list_length) end |