Permalink
Browse files

Add support for PostgreSQL range data types.

  • Loading branch information...
1 parent e0da0a8 commit 60d92fe10d3a17e859e313ace260f5344debb7b6 @guilhermesimoes guilhermesimoes committed Jan 5, 2014
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/seed_dump/dump_methods.rb
@@ -40,13 +40,21 @@ def value_to_s(value)
value.to_s
when Date, Time, DateTime
value.to_s(:db)
+ when Range
+ range_to_string(value)
else
value
end
value.inspect
end
+ def range_to_string(object)
+ from = object.begin.respond_to?(:infinite?) && object.begin.infinite? ? '' : object.begin
+ to = object.end.respond_to?(:infinite?) && object.end.infinite? ? '' : object.end
+ "[#{from},#{to}#{object.exclude_end? ? ')' : ']'}"
+ end
+
def open_io(options)
if options[:file].present?
mode = options[:append] ? 'a+' : 'w+'

0 comments on commit 60d92fe

Please sign in to comment.