Sha256: 50202e41a1fdfb52ff146bc1e4feab8a5a50f8303dc098106b96b99f8f0d52a7

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# -*- encoding : utf-8 -*-
=begin
  Copyright (C) 2008 Sam Roberts

  This library is free software; you can redistribute it and/or modify it
  under the same terms as the ruby language itself, see the file COPYING for
  details.
=end

module Vpim
  class Icalendar
    module Property
      module Location
        # Physical location information relevant to the component, or nil if
        # there is no LOCATION property.
        def location
          proptext 'LOCATION'
        end

        # Array of Float, +[ latitude, longitude]+.
        #
        # North of the equator is positive latitude, east of the meridian is
        # positive longitude.
        #
        # See RFC2445 for more info... there are lots of special cases.
        def geo
          prop = @properties.detect { |f| f.name? 'GEO' }
          if prop
            prop = Vpim.decode_list(prop.value_raw, ';') do |item| item.to_f end
          end
          prop
        end
      end
    end

    # add a location property to (v)events. This is specified in the RFC 2445
    module Set
      module Location
        def location(value)
          set_text 'LOCATION', value
        end
      end
    end

  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vpim-24.2.20 lib/vpim/property/location.rb
vpim-13.11.11 lib/vpim/property/location.rb