Class: Ariel::Wildcards
- Inherits:
-
Object
- Object
- Ariel::Wildcards
- Defined in:
- lib/ariel/wildcards.rb
Overview
Contains all wildcards to be used in rule generation.
Class Method Summary collapse
-
.list ⇒ Object
Returns the hash of wildcard name (symbol) and regular expression pairs.
-
.matching(string) ⇒ Object
Given a string, will return an array of symbols from Wildcards::list that match it.
Class Method Details
.list ⇒ Object
Returns the hash of wildcard name (symbol) and regular expression pairs.
18 19 20 |
# File 'lib/ariel/wildcards.rb', line 18 def list @list end |
.matching(string) ⇒ Object
Given a string, will return an array of symbols from Wildcards::list that match it.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ariel/wildcards.rb', line 24 def matching(string) matches=[] @list.each do |name, regex| if string[regex]==string yield name if block_given? matches << name end end matches end |