Class: JsonStatham::Requests::Observer
- Defined in:
- lib/json_statham/requests/observer.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#ending ⇒ Object
readonly
Returns the value of attribute ending.
-
#starting ⇒ Object
readonly
Returns the value of attribute starting.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#base_path, call, #file_path, #folder?, #folder_path, #initialize, #schema_name, #splitted_name
Constructor Details
This class inherits a constructor from JsonStatham::Requests::Base
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/json_statham/requests/observer.rb', line 6 def data @data end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
6 7 8 |
# File 'lib/json_statham/requests/observer.rb', line 6 def duration @duration end |
#ending ⇒ Object (readonly)
Returns the value of attribute ending.
6 7 8 |
# File 'lib/json_statham/requests/observer.rb', line 6 def ending @ending end |
#starting ⇒ Object (readonly)
Returns the value of attribute starting.
6 7 8 |
# File 'lib/json_statham/requests/observer.rb', line 6 def starting @starting end |
Class Method Details
.clock_gettime ⇒ Object
8 9 10 |
# File 'lib/json_statham/requests/observer.rb', line 8 def self.clock_gettime Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second) end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/json_statham/requests/observer.rb', line 12 def call @starting = clock_gettime @data = block.call @ending = clock_gettime @duration = ending - starting self end |
#clock_gettime ⇒ Object
21 22 23 |
# File 'lib/json_statham/requests/observer.rb', line 21 def clock_gettime self.class.clock_gettime end |