Class: Tracing::ArgumentFilter

Inherits:
BaseFilter show all
Defined in:
lib/filters/simple/argument_filter.rb

Overview

filter on instance variables

Instance Attribute Summary collapse

Attributes inherited from BaseFilter

#name, #rules

Instance Method Summary collapse

Methods inherited from BaseFilter

#name_allow_action, register_filters, unregister_filters

Constructor Details

#initialize(options) ⇒ ArgumentFilter

Returns a new instance of ArgumentFilter.



6
7
8
9
10
# File 'lib/filters/simple/argument_filter.rb', line 6

def initialize(options)
  super(options)    
  @rules = options[:arg_rules] || options[:args_filter] || {}
  @var_name = options[:arg_name]
end

Instance Attribute Details

#var_nameObject

Returns the value of attribute var_name.



4
5
6
# File 'lib/filters/simple/argument_filter.rb', line 4

def var_name
  @var_name
end

Instance Method Details

#allow_action(msg, context) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/filters/simple/argument_filter.rb', line 12

def allow_action(msg, context)
  puts "AMF"
  obj = context[:args]
  if var_name.kind_of?(Symbol) || var_name.kind_of?(String)
    key = var_name.to_sym
    if obj.has_key? key
      value = obj[key]      
      return name_allow_action(value)
    end
  end
  :yield
end