Skip to content

Commit

Permalink
Merge pull request #3 from rngtng/fix-wrong-scope
Browse files Browse the repository at this point in the history
Fix wrong scope, add Travis
  • Loading branch information
qoobaa committed Nov 30, 2012
2 parents a6b83e8 + eacdb84 commit d69bd89
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
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

0 comments on commit d69bd89

Please sign in to comment.