Module: Activerecord::Multirange::Quoting

Defined in:
lib/activerecord-multirange/quoting.rb

Instance Method Summary collapse

Instance Method Details

#encode_multirange(range_data) ⇒ Object



18
19
20
21
22
# File 'lib/activerecord-multirange/quoting.rb', line 18

def encode_multirange(range_data)
  collection = range_data.ranges.map { |r| encode_range(r) }.join(",")

  "{#{collection}}"
end

#quote(value) ⇒ Object



6
7
8
9
10
# File 'lib/activerecord-multirange/quoting.rb', line 6

def quote(value)
  return quote(encode_multirange(value)) if value.is_a?(::Activerecord::Multirange::OID::MultiRange::Data)

  super
end

#type_cast(value) ⇒ Object



12
13
14
15
16
# File 'lib/activerecord-multirange/quoting.rb', line 12

def type_cast(value)
  return encode_multirange(value) if value.is_a?(::Activerecord::Multirange::OID::MultiRange::Data)

  super
end