Module: Rules
- Defined in:
- lib/city_watch/util/rules.rb
Instance Method Summary collapse
Instance Method Details
#add_rule(name, &block) ⇒ Object
3 4 5 6 |
# File 'lib/city_watch/util/rules.rb', line 3 def add_rule(name,&block) @rules ||= {} @rules[name] = block end |
#run_rules(dat, rcv = nil, host = nil) ⇒ Object
8 9 10 11 12 |
# File 'lib/city_watch/util/rules.rb', line 8 def run_rules(dat,rcv=nil,host=nil) @rules.map do |(name,rule)| rule.call(dat) end if @rules end |