Class: Xcprofiler::Execution
- Inherits:
-
Object
- Object
- Xcprofiler::Execution
- Defined in:
- lib/xcprofiler/execution.rb
Defined Under Namespace
Classes: Location
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #column ⇒ Object
- #filename ⇒ Object
-
#initialize(time, location, method_name) ⇒ Execution
constructor
A new instance of Execution.
- #invalid? ⇒ Boolean
- #line ⇒ Object
- #path ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(time, location, method_name) ⇒ Execution
Returns a new instance of Execution.
7 8 9 10 11 12 13 14 |
# File 'lib/xcprofiler/execution.rb', line 7 def initialize(time, location, method_name) @time = time.to_f unless location =~ /<invalid loc>/ path, line, column = location.split(':') @location = Location.new(path, line.to_i, column.to_i) end @method_name = method_name end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/xcprofiler/execution.rb', line 5 def location @location end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
5 6 7 |
# File 'lib/xcprofiler/execution.rb', line 5 def method_name @method_name end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/xcprofiler/execution.rb', line 5 def time @time end |
Instance Method Details
#column ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/xcprofiler/execution.rb', line 46 def column if @location @location.column else nil end end |
#filename ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/xcprofiler/execution.rb', line 38 def filename if path File.basename(path) else nil end end |
#invalid? ⇒ Boolean
26 27 28 |
# File 'lib/xcprofiler/execution.rb', line 26 def invalid? !location end |
#line ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/xcprofiler/execution.rb', line 54 def line if @location @location.line else nil end end |
#path ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/xcprofiler/execution.rb', line 30 def path if @location @location.path else nil end end |
#to_h ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/xcprofiler/execution.rb', line 16 def to_h { method_name: method_name, time: time, path: path, line: line, column: column } end |