Skip to content
Browse files

might help if i added the new file, updated readme too

  • Loading branch information...
1 parent 9c0fa3b commit 38f341d794448b1e028d367d81d8d4cb8435492e bglusman committed Feb 9, 2012
Showing with 17 additions and 0 deletions.
  1. +9 −0
  2. +8 −0 lib/outlaw/rule_methods.rb
@@ -36,6 +36,9 @@ Some examples are include in the .outlawed.example file for reference:
outlaw "class :symbol < :core_class", "core classes implemented in c,
can cause bad mojo"
+ outlaw :trailing_whitespace
The first three examples are actual ruby keywords and features being outlawed
and may not require much explanation except to indicate that they are detected
via regular expression matches constructed from the strings, and attempt to use
@@ -56,6 +59,12 @@ patterns as above. Presently mutliple references to the same collection
are independent, but if there is interest special handling could be added to
also match specific instances of a collection much like the symbol handling.
+The last one is a custom rule that calls a method defined on the Outlaw
+module called 'trailing_whitespace' which returns a Rule object. Any
+such new methods may be defined in the .outlawed file (since it is
+module_eval'd into the outlaw namespace) and then outawed the same way.
Outlaw currently ignores whitespace, parentheses and new lines, though I have
ideas to change this behavior dynamically in certain rules if desired.
8 lib/outlaw/rule_methods.rb
@@ -0,0 +1,8 @@
+module Outlaw
+ def trailing_whitespace
+"Trailing whitespace",
+ "Trailing whitespace is ugly and can mess up version history") do |file|
+ file.match(/ \n/)
+ end
+ end

0 comments on commit 38f341d

Please sign in to comment.
Something went wrong with that request. Please try again.