Class: Kudzu::Config::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/kudzu/config/filter.rb

Defined Under Namespace

Classes: Delegator

Constant Summary collapse

SIMPLE_CONFIGS =

url filter

[# url filter
:focus_host, :focus_descendants, :allow_element, :deny_element,
:allow_url, :deny_url, :allow_host, :deny_host, :allow_path, :deny_path,
:allow_ext, :deny_ext,
# page filter
:allow_mime_type, :deny_mime_type, :max_size]
DEFAULT_CONFIG =
{ focus_host: false,
focus_descendants: false }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, config = {}, &block) ⇒ Filter

Returns a new instance of Filter.



16
17
18
19
20
21
22
23
24
# File 'lib/kudzu/config/filter.rb', line 16

def initialize(path, config = {}, &block)
  @path = path
  DEFAULT_CONFIG.merge(config).each do |key, value|
    send("#{key}=", value)
  end
  if block
    Delegator.new(self).instance_eval(&block)
  end
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



13
14
15
# File 'lib/kudzu/config/filter.rb', line 13

def path
  @path
end