Got travis working, fixed ruby 1.9.3 compatibility

This commit is contained in:
Dan Hirsch 2014-01-11 04:27:40 +01:00
parent df196aa346
commit 982665aafa
4 changed files with 32 additions and 17 deletions

View file

@ -4,4 +4,5 @@ gemspec
group :test do
gem 'minitest', '~> 5.2'
gem 'rake', '>10'
end

View file

@ -9,11 +9,15 @@ rubysources = [
"hammer-parser.gemspec",
"Rakefile",
"Gemfile",
"Gemfile.lock",
"README.md",
]
rubyenv = env.Clone()
for k,v in os.environ.items():
if "RUBY" in k or "GEM" in k or "rvm" in k:
rubyenv['ENV'][k] = v
rubyenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
rubyenv['RBDIR'] = os.path.dirname(str(rubyenv.File("Gemfile").path))

View file

@ -113,8 +113,8 @@ module Hammer
def self.marshal_ch_arg(num)
if num.is_a?(String)
raise ArgumentError, "Expecting either a fixnum in 0..255 or a single-byte String" unless num.bytes.length == 1
num = num.bytes[0]
raise ArgumentError, "Expecting either a fixnum in 0..255 or a single-byte String" unless num.bytesize == 1
num = num.bytes.first
end
raise ArgumentError, 'Expecting a Fixnum in 0..255 or a single-byte String' unless num.is_a?(Fixnum) and num.between?(0, 255)
return num