module Maid::RuleContainer

Attributes

rules[R]

Public Instance Methods

follow_rules(*args) click to toggle source

Follow all registered rules.

# File lib/maid/rule_container.rb, line 17
def follow_rules(*args)
  @rules.each do |rule|
    @logger.info("Rule: #{ rule.description }") unless @logger.nil?
    rule.follow(*args)
  end
end
initialize_rules(&rules) click to toggle source

initialize_rules

# File lib/maid/rule_container.rb, line 6
def initialize_rules(&rules)
  @rules ||= []
  instance_exec(&rules)
end
rule(description, &instructions) click to toggle source

Register a rule with a description and instructions (lambda function).

# File lib/maid/rule_container.rb, line 12
def rule(description, &instructions)
  @rules << ::Maid::Rule.new(description, instructions, @maid || self)
end