Class: ProconBypassMan::Procon::PerformanceMeasurement::LastBypassAt
- Inherits:
-
Object
- Object
- ProconBypassMan::Procon::PerformanceMeasurement::LastBypassAt
- Includes:
- Singleton
- Defined in:
- lib/procon_bypass_man/procon/performance_measurement/last_bypass_at.rb
Instance Attribute Summary collapse
-
#last_bypass_at ⇒ Object
Returns the value of attribute last_bypass_at.
-
#mutex ⇒ Object
Returns the value of attribute mutex.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ LastBypassAt
constructor
A new instance of LastBypassAt.
Constructor Details
#initialize ⇒ LastBypassAt
Returns a new instance of LastBypassAt.
6 7 8 9 |
# File 'lib/procon_bypass_man/procon/performance_measurement/last_bypass_at.rb', line 6 def initialize self.mutex = Mutex.new self.last_bypass_at = Time.now end |
Instance Attribute Details
#last_bypass_at ⇒ Object
Returns the value of attribute last_bypass_at.
4 5 6 |
# File 'lib/procon_bypass_man/procon/performance_measurement/last_bypass_at.rb', line 4 def last_bypass_at @last_bypass_at end |
#mutex ⇒ Object
Returns the value of attribute mutex.
4 5 6 |
# File 'lib/procon_bypass_man/procon/performance_measurement/last_bypass_at.rb', line 4 def mutex @mutex end |
Class Method Details
.touch(&block) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/procon_bypass_man/procon/performance_measurement/last_bypass_at.rb', line 11 def self.touch(&block) instance.mutex.synchronize do block.call(Time.now - instance.last_bypass_at) instance.last_bypass_at = Time.now end end |