Sha256: e052bc99e37b4cb57a162483dfe24d6606371ad63aca1b5e758582dceeda4030

Contents?: true

Size: 1.79 KB

Versions: 19

Compression:

Stored size: 1.79 KB

Contents

=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

require 'vpim/version'

#:main:README
#:title:vPim - vCard and iCalendar support for Ruby
module Vpim
  # Exception used to indicate that data being decoded is invalid, the message
  # should describe what is invalid.
  class InvalidEncodingError < StandardError; end

  # Exception used to indicate that data being decoded is unsupported, the message
  # should describe what is unsupported.
  #
  # If its unsupported, its likely because I didn't anticipate it being useful
  # to support this, and it likely it could be supported on request.
  class UnsupportedError < StandardError; end
  
  # Exception used to indicate that encoding failed, probably because the
  # object would not result in validly encoded data. The message should
  # describe what is unsupported.
  class Unencodeable < StandardError; end
end

module Vpim::Methods #:nodoc:
  module_function

  # Case-insensitive comparison of +str0+ to +str1+, returns true or false.
  # Either argument can be nil, where nil compares not equal to anything other
  # than nil.
  #
  # This is available both as a module function:
  #   Vpim::Methods.casecmp?("yes", "YES")
  # and an instance method:
  #   include Vpim::Methods
  #   casecmp?("yes", "YES")
  #
  # Will work with ruby1.6 and ruby 1.8.
  #
  # TODO - could make this be more efficient, but I'm supporting 1.6, not
  # optimizing for it.
  def casecmp?(str0, str1)
    if str0 == nil
      if str1 == nil
        return true
      else
        return false
      end
    end

    begin
      str0.casecmp(str1) == 0
    rescue NoMethodError
      str0.downcase == str1.downcase
    end
  end

end

Version data entries

19 entries across 19 versions & 11 rubygems

Version Path
fraser-vpim-0.658 lib/vpim/vpim.rb
fraser-vpim-0.659 lib/vpim/vpim.rb
fraser-vpim-rails-0.658 lib/vpim/vpim.rb
fraser-vpim-rails-0.659 lib/vpim/vpim.rb
xing-vpim-0.658.1 lib/vpim/vpim.rb
vpim2-0.0.1 lib/vpim/vpim.rb
vpim-rails-reinteractive-0.7 lib/vpim/vpim.rb
vpim-rails-0.665 lib/vpim/vpim.rb
thoughtafter-vpim-0.7.0.1 lib/vpim/vpim.rb
vpim-rails-0.664 lib/vpim/vpim.rb
vpim-rails-0.663 lib/vpim/vpim.rb
vpim-rails-0.662 lib/vpim/vpim.rb
scashin133-vpim-9.4.0 lib/vpim/vpim.rb
vpim-rails-0.661 lib/vpim/vpim.rb
mumboe-vpim-0.7 lib/vpim/vpim.rb
mumboe-vpim-0.695 lib/vpim/vpim.rb
fairtilizer-vpim-0.695 lib/vpim/vpim.rb
vpim-0.658 lib/vpim/vpim.rb
vpim-0.695 lib/vpim/vpim.rb