Sha256: 2c1d6d41fa075ab0731ab1e825a619967b362fb97084d97130c6b1f5878dd614

Contents?: true

Size: 679 Bytes

Versions: 6

Compression:

Stored size: 679 Bytes

Contents

module OData4
  module Properties
    module Geography
      class LineString < Base
        def type
          'Edm.GeographyLineString'
        end

        def coords_to_s
          value.map { |pos| pos.join(' ') }.join(',')
        end

        def coords_from_s(str)
          str.split(',').map { |pos| pos.split(' ').map(&:to_f) }
        end

        def xml_value
          value.map do |coords|
            { pos: coords.join(' ') }
          end
        end

        private

        def self.parse_xml(property_xml)
          property_xml.xpath('//pos').map do |el|
            el.content.split(' ').map(&:to_f)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
odata4-0.9.1 lib/odata4/properties/geography/line_string.rb
odata4-0.9.0 lib/odata4/properties/geography/line_string.rb
odata4-0.8.2 lib/odata4/properties/geography/line_string.rb
odata4-0.8.1 lib/odata4/properties/geography/line_string.rb
odata4-0.8.0 lib/odata4/properties/geography/line_string.rb
odata4-0.7.0 lib/odata4/properties/geography/line_string.rb