class Arel::Nodes::Case

def else(expression)

def else(expression)
  @default = Else.new Nodes.build_quoted(expression)
  self
end

def eql?(other)

def eql?(other)
  self.class == other.class &&
    self.case == other.case &&
    self.conditions == other.conditions &&
    self.default == other.default
end

def hash

def hash
  [@case, @conditions, @default].hash
end

def initialize(expression = nil, default = nil)

def initialize(expression = nil, default = nil)
  @case = expression
  @conditions = []
  @default = default
end

def initialize_copy(other)

def initialize_copy(other)
  super
  @case = @case.clone if @case
  @conditions = @conditions.map { |x| x.clone }
  @default = @default.clone if @default
end

def then(expression)

def then(expression)
  @conditions.last.right = Nodes.build_quoted(expression)
  self
end

def when(condition, expression = nil)

def when(condition, expression = nil)
  @conditions << When.new(Nodes.build_quoted(condition), expression)
  self
end