Permalink
Browse files

fix boolean return, dry up code a bit

  • Loading branch information...
kyledrake committed Nov 12, 2012
1 parent efe6c59 commit bf590ea3fc3c0d94be276737e997cb1cfdd49746
Showing with 16 additions and 10 deletions.
  1. +15 −9 lib/running.rb
  2. +1 −1 running.gemspec
View
@@ -8,27 +8,27 @@ def ruby?
end
def ruby_18?
- ruby? && RUBY_VERSION =~ /^1.8/
+ ruby? && ruby_version_matches(1.8)
end
def ruby_19?
- ruby? && RUBY_VERSION =~ /^1.9/
+ ruby? && ruby_version_matches(1.9)
end
def ruby_20?
- ruby? && RUBY_VERSION =~ /^2.0/
+ ruby? && ruby_version_matches(2.0)
end
def mri?
!mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby")
end
def mri_18?
- mri? && RUBY_VERSION =~ /^1.8/
+ mri? && ruby_version_matches(1.8)
end
def mri_19?
- mri? && RUBY_VERSION =~ /^1.9/
+ mri? && ruby_version_matches(1.9)
end
def rbx?
@@ -52,19 +52,25 @@ def mingw?
end
def mingw_18?
- mingw? && RUBY_VERSION =~ /^1.8/
+ mingw? && ruby_version_matches(1.8)
end
def mingw_19?
- mingw? && RUBY_VERSION =~ /^1.9/
+ mingw? && ruby_version_matches(1.9)
end
def mingw_20?
- mingw? && RUBY_VERSION =~ /^2.0/
+ mingw? && ruby_version_matches(2.0)
end
def from_the_police?
true
end
+
+ private
+
+ def ruby_version_matches(version)
+ !(RUBY_VERSION =~ /^#{version}/).nil?
+ end
end
-end
+end
View
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'running'
- s.version = '0.0.5'
+ s.version = '0.0.6'
s.authors = ['Kyle Drake']
s.email = ['kyledrake@gmail.com']
s.homepage = 'http://github.com/kyledrake/running'

0 comments on commit bf590ea

Please sign in to comment.