Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong scope, add Travis #3

Merged
merged 3 commits into from
Nov 30, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
.rvmrc
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source "https://rubygems.org"

gemspec


gem "rake"
14 changes: 7 additions & 7 deletions lib/vcard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]

Expand All @@ -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

Expand All @@ -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]

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down