Permalink
Browse files

added system for custom rules and implemented trailing whitespace rule

  • Loading branch information...
1 parent d31f672 commit 9c0fa3bd6d500aeaf5e2518d1a10787e8b68805d bglusman committed Feb 10, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/outlaw.rb
View
@@ -2,16 +2,21 @@
require_relative 'outlaw/law_parser'
require_relative 'outlaw/enforcement'
require_relative 'outlaw/rule'
+require_relative 'outlaw/rule_methods'
module Outlaw
extend self
attr_accessor :ignore_types, :param_types
- def outlaw(pattern, message)
- rule = Rule.new(pattern, message)
- Outlaw::Enforcement.add(rule)
+ def outlaw(pattern, message=nil)
+ if pattern.kind_of?(String)
+ rule = Rule.new(pattern, message)
+ Outlaw::Enforcement.add(rule)
+ else
+ Outlaw::Enforcement.add(self.send(pattern))
+ end
end
def enforce(dir=".")

0 comments on commit 9c0fa3b

Please sign in to comment.