Class: Teeth::RuleStatementGroup

Inherits:
Array
  • Object
show all
Defined in:
lib/teeth/rule_statement.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(called_method_name, *args, &block) ⇒ Object



55
56
57
58
# File 'lib/teeth/rule_statement.rb', line 55

def method_missing(called_method_name, *args, &block)
  args[1] ||={}
  add(called_method_name, args[0], args[1])
end

Instance Method Details

#add(name, regex, options = {}) ⇒ Object



47
48
49
# File 'lib/teeth/rule_statement.rb', line 47

def add(name, regex, options={})
  push RuleStatement.new(name, regex, options)
end

#rule_namesObject



51
52
53
# File 'lib/teeth/rule_statement.rb', line 51

def rule_names
  map { |rule_statement| rule_statement.name.to_s }
end