Class: LdapSearchProfiler::Timer
- Inherits:
-
Object
- Object
- LdapSearchProfiler::Timer
- Defined in:
- lib/ldapmodel/profiler.rb
Instance Attribute Summary (collapse)
-
- (Object) duration
Returns the value of attribute duration.
Instance Method Summary (collapse)
-
- (Timer) initialize
constructor
A new instance of Timer.
- - (Object) stop(msg = "")
Constructor Details
- (Timer) initialize
Returns a new instance of Timer
18 19 20 21 |
# File 'lib/ldapmodel/profiler.rb', line 18 def initialize @started = Time.now @duration = 0 end |
Instance Attribute Details
- (Object) duration
Returns the value of attribute duration
17 18 19 |
# File 'lib/ldapmodel/profiler.rb', line 17 def duration @duration end |
Instance Method Details
- (Object) stop(msg = "")
23 24 25 26 27 28 29 |
# File 'lib/ldapmodel/profiler.rb', line 23 def stop(msg="") if ENV["LDAP_PROFILER"] color = :blue @duration = (Time.now - @started).to_f * 1000 puts "#{ msg } in #{ @duration } ms".colorize(color) end end |