Class: Ariel::Wildcards

Inherits:
Object
  • Object
show all
Defined in:
lib/ariel/wildcards.rb

Overview

Contains all wildcards to be used in rule generation.

Class Method Summary collapse

Class Method Details

.listObject

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