diff --git a/.gitignore b/.gitignore index d87d4be..f1fdeb5 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ spec/reports test/tmp test/version_tmp tmp +.rvmrc diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c1ce150 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: ruby +script: bundle exec rake +rvm: + - 1.8.7 + - 1.9.2 + - 1.9.3 + # - ruby-head + # - ree + # - rbx-18mode + # - rbx-19mode + # - jruby-18mode + # - jruby-19mode + # - jruby-head +matrix: + allow_failures: + - rvm: 1.8.7 diff --git a/Gemfile b/Gemfile index b4e2a20..0b4bef0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,6 @@ source "https://rubygems.org" gemspec + + +gem "rake" diff --git a/lib/vcard.rb b/lib/vcard.rb index 8f0c2f3..f98945f 100644 --- a/lib/vcard.rb +++ b/lib/vcard.rb @@ -55,7 +55,7 @@ def self.decode_list(value, sep = ",") # :nodoc: # Convert a RFC 2425 date into an array of [year, month, day]. def self.decode_date(v) # :nodoc: unless v =~ %r{^\s*#{Bnf::DATE}\s*$} - raise Vcard::InvalidEncodingError, "date not valid (#{v})" + raise ::Vcard::InvalidEncodingError, "date not valid (#{v})" end [$1.to_i, $2.to_i, $3.to_i] end @@ -86,7 +86,7 @@ def self.encode_date_time(d) # :nodoc: # Convert a RFC 2425 time into an array of [hour,min,sec,secfrac,timezone] def self.decode_time(v) # :nodoc: unless match = %r{^\s*#{Bnf::TIME}\s*$}.match(v) - raise Vcard::InvalidEncodingError, "time '#{v}' not valid" + raise ::Vcard::InvalidEncodingError, "time '#{v}' not valid" end hour, min, sec, secfrac, tz = match.to_a[1..5] @@ -99,7 +99,7 @@ def self.array_datetime_to_time(dtarray) #:nodoc: tz = (dtarray.pop == "Z") ? :gm : :local Time.send(tz, *dtarray) rescue ArgumentError => e - raise Vcard::InvalidEncodingError, "#{tz} #{e} (#{dtarray.join(', ')})" + raise ::Vcard::InvalidEncodingError, "#{tz} #{e} (#{dtarray.join(', ')})" end end @@ -111,7 +111,7 @@ def self.decode_time_to_time(v) # :nodoc: # Convert a RFC 2425 date-time into an array of [year,mon,day,hour,min,sec,secfrac,timezone] def self.decode_date_time(v) # :nodoc: unless match = %r{^\s*#{Bnf::DATE}T#{Bnf::TIME}\s*$}.match(v) - raise Vcard::InvalidEncodingError, "date-time '#{v}' not valid" + raise ::Vcard::InvalidEncodingError, "date-time '#{v}' not valid" end year, month, day, hour, min, sec, secfrac, tz = match.to_a[1..8] @@ -138,7 +138,7 @@ def self.decode_date_time_to_datetime(v) #:nodoc: # Convert an RFC2425 INTEGER value into an Integer def self.decode_integer(v) # :nodoc: unless %r{\s*#{Bnf::INTEGER}\s*}.match(v) - raise Vcard::InvalidEncodingError, "integer not valid (#{v})" + raise ::Vcard::InvalidEncodingError, "integer not valid (#{v})" end v.to_i end @@ -231,7 +231,7 @@ def self.encode_paramtext(value) when %r{\A#{Bnf::SAFECHAR}*\z} value else - raise Vcard::Unencodable, "paramtext #{value.inspect}" + raise ::Vcard::Unencodable, "paramtext #{value.inspect}" end end @@ -242,7 +242,7 @@ def self.encode_paramvalue(value) when %r{\A#{Bnf::QSAFECHAR}*\z} '"' + value + '"' else - raise Vcard::Unencodable, "param-value #{value.inspect}" + raise ::Vcard::Unencodable, "param-value #{value.inspect}" end end