Permalink
Browse files

rewrites a couple of alternations in regexps as character classes

Character classes are the specific regexp construct
to express alternation of individual characters.
  • Loading branch information...
fxn committed Jan 30, 2012
1 parent 211174a commit 7619bcf2d4a348cb48b765e1980e935abbcc694f
@@ -333,7 +333,7 @@ def type_cast_using_column(value, column)
def select_for_count
if @select_values.present?
select = @select_values.join(", ")
- select if select !~ /(,|\*)/
+ select if select !~ /[,*]/
end
end
@@ -32,7 +32,7 @@ def parse_type_and_options(type)
case type
when /(string|text|binary|integer)\{(\d+)\}/
return $1, :limit => $2.to_i
- when /decimal\{(\d+)(,|\.|\-)(\d+)\}/
+ when /decimal\{(\d+)[,.-](\d+)\}/
return :decimal, :precision => $1.to_i, :scale => $3.to_i
else
return type, {}

0 comments on commit 7619bcf

Please sign in to comment.