class Pask::Event
Constants
- CALL
- C_CALL
- C_RETURN
- KNOWN_NAMES
- RETURN
Public Class Methods
new(name, other)
click to toggle source
# File lib/pask/event.rb, line 8 def initialize(name, other) @name = name @other = other @created_at = Time.now @signature = nil @to_f = nil @emit_by = binding.eval "self" end
Public Instance Methods
-(other)
click to toggle source
# File lib/pask/event.rb, line 90 def -(other) unless other.respond_to?(:to_f) raise TypeError, "cannot coerce argument to a float" end to_f - other.to_f end
__binding__()
click to toggle source
# File lib/pask/event.rb, line 46 def __binding__ Kernel.binding end
any_call?()
click to toggle source
# File lib/pask/event.rb, line 50 def any_call? call? or c_call? end
any_return?()
click to toggle source
# File lib/pask/event.rb, line 70 def any_return? return? or c_return? end
binding()
click to toggle source
# File lib/pask/event.rb, line 42 def binding @other[:binding] end
c_call?()
click to toggle source
# File lib/pask/event.rb, line 66 def c_call? @name == C_CALL end
c_return?()
click to toggle source
# File lib/pask/event.rb, line 58 def c_return? @name == C_RETURN end
call?()
click to toggle source
# File lib/pask/event.rb, line 62 def call? @name == CALL end
created_at()
click to toggle source
# File lib/pask/event.rb, line 26 def created_at @created_at end
emit_by()
click to toggle source
# File lib/pask/event.rb, line 17 def emit_by # FIXME: messed up for C calls and returns. maybe return nil for them? @emit_by end
emit_by_method()
click to toggle source
# File lib/pask/event.rb, line 38 def emit_by_method @other[:method] end
file()
click to toggle source
# File lib/pask/event.rb, line 30 def file @other[:file] end
lineno()
click to toggle source
# File lib/pask/event.rb, line 34 def lineno @other[:lineno] end
origin?(mod)
click to toggle source
# File lib/pask/event.rb, line 74 def origin?(mod) if emit_by.respond_to?(:ancestors) emit_by.ancestors.include?(mod) else mod === emit_by end end
return?()
click to toggle source
# File lib/pask/event.rb, line 54 def return? @name == RETURN end
signature()
click to toggle source
# File lib/pask/event.rb, line 82 def signature @signature ||= if emit_by.kind_of?(Module) [emit_by, @method].join(".") else [emit_by.class, @method].join("#") end end
to_f()
click to toggle source
# File lib/pask/event.rb, line 22 def to_f @to_f ||= @created_at.to_f end