Sha256: 4c9f93e4186537ee9e6a362fe1b1ee0b0546dea4be58e81b940820d0aa0a4dde

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

require 'sqlpostgres/PgTwoPoints'

module SqlPostgres

  # This class holds the value of a "point" column.

  class PgBox < PgTwoPoints

    class << self

      # Create a PgBox from a string in Postgres format

      def from_sql(s)
        if s =~ /^(\(.*\)),(\(.*\))$/
          PgBox.new(PgPoint.from_sql($1), PgPoint.from_sql($2))
        else
          raise ArgumentError, "Invalid box: #{s.inspect}"
        end
      end

    end

    private

    def column_type
      'box'
    end

  end

end

# Local Variables:
# tab-width: 2
# ruby-indent-level: 2
# indent-tabs-mode: nil
# End:

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sqlpostgres-1.2.6 lib/sqlpostgres/PgBox.rb
sqlpostgres-1.2.5 lib/sqlpostgres/PgBox.rb
sqlpostgres-1.2.4 lib/sqlpostgres/PgBox.rb