Module: OpenAssets::MethodFilter::Filters

Defined in:
lib/openassets/medhod_filter.rb

Instance Method Summary collapse

Instance Method Details

#before_filter(method, options = {}) ⇒ Object



6
7
8
9
# File 'lib/openassets/medhod_filter.rb', line 6

def before_filter(method, options = {})
  @before_filters ||= {}
  @before_filters[method] = options
end

#filtered_method?(method, options) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/openassets/medhod_filter.rb', line 11

def filtered_method?(method, options)
  if options.has_key? :include
    return true if options[:include].include? method.intern
    false
  elsif options.has_key? :exclude
    return false if options[:exclude].include? method.intern
    true
  else
    true
  end
end