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/.freeze
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
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/trace_location/event.rb', line 8 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
30 31 32 |
# File 'lib/trace_location/event.rb', line 30 def call? event == :call end |
#invalid? ⇒ Boolean
26 27 28 |
# File 'lib/trace_location/event.rb', line 26 def invalid? !valid? end |
#owner_with_name ⇒ Object
38 39 40 41 42 |
# File 'lib/trace_location/event.rb', line 38 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
34 35 36 |
# File 'lib/trace_location/event.rb', line 34 def return? event == :return end |
#valid? ⇒ Boolean
22 23 24 |
# File 'lib/trace_location/event.rb', line 22 def valid? hierarchy >= 0 end |