Sha256: c58451f2b5ec9b4f4274ea0ee6aba8a23b7a8b149fd762c56a20591c9b964cc3

Contents?: true

Size: 537 Bytes

Versions: 1

Compression:

Stored size: 537 Bytes

Contents

module Ecircle
  module Helper
    extend self

    # @private
    def date_format date
      tz = date.strftime('%z')
      matcher = /(.*)(00)/.match(tz) # We need to do that because ecircle won't accept +0200, just +02:00.
      "#{date.strftime('%Y-%m-%dT%H:%M:%S')}#{matcher[1]}:#{matcher[2]}"
    end

    def build_user_xml attributes
      '<user>' + attributes.each_with_object('') do |slice, xml|
        name, value = slice.first, slice.last;
        xml << "<#{name}>#{value}</#{name}>"
      end+'</user>'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecircle-0.0.8 lib/ecircle/helper.rb