Permalink
Browse files

Minor code simplification/refactoring

  • Loading branch information...
1 parent 55c95d4 commit c4d3b3c55c4ed02d558838eead265f6fe79ce5d9 @yrashk committed Jul 7, 2012
Showing with 5 additions and 8 deletions.
  1. +5 −8 lib/condition.ex
View
13 lib/condition.ex
@@ -24,15 +24,12 @@ end
defrecord ExQL.Condition, op: nil, exprs: [] do
use ExQL.Op, [:<, :<=, :>=, :>, :==, :and, :or]
-
- def to_string(type, condition) do
- delim = to_binary(op(condition))
- [[_, first]|rest] = lc value inlist exprs(condition), do: [delim, ExQL.Expression.join(value, type, delim)]
- ["(",[first|rest],")"]
- end
-
end
defimpl ExQL.Expression, for: ExQL.Condition do
- def join(condition, type, _delim), do: ExQL.Condition.to_string(type, condition)
+ def join(condition, type, _delim) do
+ delim = to_binary(ExQL.Condition.op(condition))
+ [[_, first]|rest] = lc value inlist ExQL.Condition.exprs(condition), do: [delim, ExQL.Expression.join(value, type, delim)]
+ ["(",[first|rest],")"]
+ end
end

0 comments on commit c4d3b3c

Please sign in to comment.