Class: Gort::RuleSet Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/gort/rule_set.rb

Overview

This class is abstract.

Abstract rule set.

Direct Known Subclasses

Group

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*rules) ⇒ RuleSet

Returns a new instance of RuleSet.

Parameters:



10
11
12
# File 'lib/gort/rule_set.rb', line 10

def initialize(*rules)
  @rules = rules.flatten.freeze
end

Instance Attribute Details

#rulesArray<Group, UserAgentRule, AllowRule, DisallowRule, Rule, InvalidLine> (readonly)

Rules in this set



16
17
18
# File 'lib/gort/rule_set.rb', line 16

def rules
  @rules
end

Instance Method Details

#merge(other) ⇒ RuleSet

Make a new set by mergin this one with another.

Parameters:

Returns:



21
22
23
# File 'lib/gort/rule_set.rb', line 21

def merge(other)
  self.class.new(rules + other.rules)
end