class CodeWeb::MethodCache

Attributes

arg_regex[RW]
method_calls[RW]

Map<String,Array<MethodCall>>

method_regex[RW]

only store the information on these methods

Public Class Methods

new(method_regex = nil) click to toggle source
# File lib/code_web/method_cache.rb, line 10
def initialize(method_regex = nil)
  @method_calls=[]
  @method_regex = method_regex
end

Public Instance Methods

<<(mc) click to toggle source
# File lib/code_web/method_cache.rb, line 15
def <<(mc)
  @method_calls << mc if detect?(mc)
end
detect?(mc) click to toggle source
# File lib/code_web/method_cache.rb, line 19
def detect?(mc)
  (method_regex.nil? || mc.full_method_name =~ method_regex) &&
    (
      arg_regex.nil? || (
        mc.hash_args? &&
        mc.arg_keys.detect {|key| key =~ arg_regex }
      )
    )
end