forked from adammck/fuzz
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed measurements to floats, added boolean, and turned off ratio
- Loading branch information
evan wheeler
committed
Jan 12, 2009
1 parent
125a30c
commit d9340b6
Showing
6 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env ruby | ||
# vim: noet | ||
|
||
module Fuzz::Token | ||
class Boolean < Base | ||
True = ["true", "t", "yes", "y"] | ||
False = ["false", "f", "no", "n"] | ||
Pattern = (True + False).join("|") | ||
|
||
# whatever variation was | ||
# matched, return a regular symbol | ||
def normalize(boolean_str) | ||
True.include?(boolean_str) ? (:true) : (:false) | ||
end | ||
|
||
def humanize(boolean_str) | ||
boolean_str == :true ? "Y" : "N" | ||
end | ||
|
||
Examples = { | ||
"n" => :false, | ||
"y" => :true, | ||
"true" => :true, | ||
"false" => :false, | ||
"yes" => :true, | ||
"no" => :false } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters