Sha256: eb6003c8e21b58efbbe73ca10e21dfa4932ef688d598b9312a7dd4be97ae1140

Contents?: true

Size: 568 Bytes

Versions: 21

Compression:

Stored size: 568 Bytes

Contents

module Maid::RuleContainer
  include ::Maid::Tools
  attr_reader :rules

  # initialize_rules
  def initialize_rules(&rules)
    @rules ||= []
    instance_exec(&rules)
  end

  # Register a rule with a description and instructions (lambda function).
  def rule(description, &instructions)
    @rules << ::Maid::Rule.new(description, instructions, @maid || self)
  end

  # Follow all registered rules.
  def follow_rules(*args)
    @rules.each do |rule|
      @logger.info("Rule: #{ rule.description }") unless @logger.nil?
      rule.follow(*args)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
maid-0.10.0.pre.alpha.1 lib/maid/rule_container.rb
maid-0.9.0.alpha.2 lib/maid/rule_container.rb
maid-0.9.0.alpha.1 lib/maid/rule_container.rb
maid-0.8.0.alpha.4 lib/maid/rule_container.rb
maid-0.8.0.alpha.3 lib/maid/rule_container.rb
maid-0.8.0.alpha.2 lib/maid/rule_container.rb
maid-0.8.0.alpha.1 lib/maid/rule_container.rb
maid-0.7.0 lib/maid/rule_container.rb
maid-0.7.0.beta.1 lib/maid/rule_container.rb
maid-0.7.0.alpha.4 lib/maid/rule_container.rb
maid-0.7.0.alpha.2 lib/maid/rule_container.rb
maid-0.7.0.alpha.1 lib/maid/rule_container.rb
maid-0.6.1 lib/maid/rule_container.rb
maid-0.6.1.alpha.1 lib/maid/rule_container.rb
maid-0.6.0 lib/maid/rule_container.rb
maid-0.6.0.beta.2 lib/maid/rule_container.rb
maid-0.6.0.beta.1 lib/maid/rule_container.rb
maid-0.6.0.alpha.6 lib/maid/rule_container.rb
maid-0.6.0.alpha.5 lib/maid/rule_container.rb
maid-0.6.0.alpha.4 lib/maid/rule_container.rb