Class: Bellbro::Timer
- Inherits:
-
Object
- Object
- Bellbro::Timer
- Defined in:
- lib/bellbro/timer.rb
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#started ⇒ Object
readonly
Returns the value of attribute started.
Instance Method Summary collapse
-
#initialize(limit = nil) ⇒ Timer
constructor
A new instance of Timer.
- #timed_out? ⇒ Boolean
Constructor Details
#initialize(limit = nil) ⇒ Timer
Returns a new instance of Timer.
5 6 7 8 |
# File 'lib/bellbro/timer.rb', line 5 def initialize(limit=nil) @limit ||= 1.hour @started = Time.current end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
3 4 5 |
# File 'lib/bellbro/timer.rb', line 3 def limit @limit end |
#started ⇒ Object (readonly)
Returns the value of attribute started.
3 4 5 |
# File 'lib/bellbro/timer.rb', line 3 def started @started end |
Instance Method Details
#timed_out? ⇒ Boolean
10 11 12 |
# File 'lib/bellbro/timer.rb', line 10 def timed_out? Time.current - started > limit end |