Sha256: 63782e51bf26ae2e12cb95508fbed24893c2e465906ec0734aa68dc5a59f5786

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 Bytes

Contents

class Armg::MysqlGeometry < ActiveModel::Type::Value
  include ActiveModel::Type::Helpers::Mutable

  DEFAULT_WKB_PARSER = Armg::WkbParser.new
  DEFAULT_WKB_GENERATOR = Armg::WkbGenerator.new

  def type
    :geometry
  end

  def deserialize(value)
    if value.is_a?(::String)
      Armg.wkb_parser.parse(value)
    else
      value
    end
  end

  def serialize(value)
    if value.nil?
      nil
    else
      Armg.wkb_generator.generate(value)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
armg-0.4.3 lib/armg/mysql_geometry.rb
armg-0.4.2 lib/armg/mysql_geometry.rb
armg-0.4.1 lib/armg/mysql_geometry.rb
armg-0.4.0 lib/armg/mysql_geometry.rb