Class: Asuka::Rules::Set
- Inherits:
-
Object
- Object
- Asuka::Rules::Set
- Defined in:
- lib/asuka/rules.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize(rules = []) ⇒ Set
constructor
A new instance of Set.
- #rule_for(line) ⇒ Object
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
#rules ⇒ Object
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 |