Commit 0f04036b by Jon Frisby

Helpers to DRY up option handling.

parent bcf034e1
...@@ -19,4 +19,18 @@ module Annotate ...@@ -19,4 +19,18 @@ module Annotate
return false return false
end end
end end
def self.fallback(*args)
return args.detect { |arg| !arg.blank? }
end
def self.true?(val)
return false if(val.blank?)
return false unless(val =~ TRUE_RE)
return true
end
private
TRUE_RE = /^(true|t|yes|y|1)$/i
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment