Class: Asuka::Rules::Set

Inherits:
Object
  • Object
show all
Defined in:
lib/asuka/rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rules = []) ⇒ Set

Returns a new instance of Set.



5
6
7
# File 'lib/asuka/rules.rb', line 5

def initialize(rules=[])
  @rules = rules
end

Instance Attribute Details

#rulesObject

Returns the value of attribute rules.



4
5
6
# File 'lib/asuka/rules.rb', line 4

def rules
  @rules
end

Instance Method Details

#rule_for(line) ⇒ Object



9
10
11
# File 'lib/asuka/rules.rb', line 9

def rule_for(line)
  rules.detect { |r| r.match?(line) }
end