Class: TraceLocation::Event
- Inherits:
-
Object
- Object
- TraceLocation::Event
- Defined in:
- lib/trace_location/event.rb
Overview
:nodoc:
Constant Summary collapse
- CLASS_FORMAT =
/\A#<(?:Class|refinement):([A-Za-z0-9:]+).*>\z/
Instance Attribute Summary collapse
-
#caller_lineno ⇒ Object
readonly
Returns the value of attribute caller_lineno.
-
#caller_path ⇒ Object
readonly
Returns the value of attribute caller_path.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#hierarchy ⇒ Object
readonly
Returns the value of attribute hierarchy.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_module ⇒ Object
readonly
Returns the value of attribute is_module.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #call? ⇒ Boolean
-
#initialize(id:, event:, path:, lineno:, caller_path:, caller_lineno:, owner:, name:, source:, hierarchy:, is_module:) ⇒ Event
constructor
A new instance of Event.
- #invalid? ⇒ Boolean
- #owner_with_name ⇒ Object
- #return? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(id:, event:, path:, lineno:, caller_path:, caller_lineno:, owner:, name:, source:, hierarchy:, is_module:) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/trace_location/event.rb', line 9 def initialize(id:, event:, path:, lineno:, caller_path:, caller_lineno:, owner:, name:, source:, hierarchy:, is_module:) @id = id @event = event @path = path @lineno = lineno @caller_path = caller_path @caller_lineno = caller_lineno @owner = owner @name = name @source = source @hierarchy = hierarchy.to_i @is_module = is_module end |
Instance Attribute Details
#caller_lineno ⇒ Object (readonly)
Returns the value of attribute caller_lineno.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def caller_lineno @caller_lineno end |
#caller_path ⇒ Object (readonly)
Returns the value of attribute caller_path.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def caller_path @caller_path end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def event @event end |
#hierarchy ⇒ Object (readonly)
Returns the value of attribute hierarchy.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def hierarchy @hierarchy end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def id @id end |
#is_module ⇒ Object (readonly)
Returns the value of attribute is_module.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def is_module @is_module end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def lineno @lineno end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def owner @owner end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def path @path end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/trace_location/event.rb', line 6 def source @source end |
Instance Method Details
#call? ⇒ Boolean
32 33 34 |
# File 'lib/trace_location/event.rb', line 32 def call? event == :call end |
#invalid? ⇒ Boolean
28 29 30 |
# File 'lib/trace_location/event.rb', line 28 def invalid? !valid? end |
#owner_with_name ⇒ Object
40 41 42 43 44 |
# File 'lib/trace_location/event.rb', line 40 def owner_with_name match = owner.to_s.match(CLASS_FORMAT) separator = is_module ? '.' : '#' match ? "#{match[1]}#{separator}#{name}" : "#{owner}#{separator}#{name}" end |
#return? ⇒ Boolean
36 37 38 |
# File 'lib/trace_location/event.rb', line 36 def return? event == :return end |
#valid? ⇒ Boolean
24 25 26 |
# File 'lib/trace_location/event.rb', line 24 def valid? hierarchy >= 0 end |