Module: WhereableClause::ConditionIn

Defined in:
lib/whereable_clause.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject

Hash for in operator



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/whereable_clause.rb', line 63

def to_h
  if opt.empty?
    {
      eq: {
        column: column.to_s,
        literal: literal.to_s,
      },
    }
  else
    {
      in: {
        column: column.to_s,
        literals: [literal.to_s] + opt.elements.map { |o| o.literal.to_s },
      },
    }
  end
end