Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix boolean return, dry up code a bit

  • Loading branch information...
commit bf590ea3fc3c0d94be276737e997cb1cfdd49746 1 parent efe6c59
@kyledrake authored
Showing with 16 additions and 10 deletions.
  1. +15 −9 lib/running.rb
  2. +1 −1  running.gemspec
View
24 lib/running.rb
@@ -8,15 +8,15 @@ 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?
@@ -24,11 +24,11 @@ def mri?
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
2  running.gemspec
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.