Skip to content

Commit

Permalink
RuboCop coding conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
JaniJegoroff committed Oct 3, 2014
1 parent ade9a9f commit dc09dd5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
18 changes: 17 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
PATH
remote: .
specs:
to_boolean (1.0.1)
to_boolean (1.0.2)

GEM
remote: https://rubygems.org/
specs:
ansi (1.4.3)
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
builder (3.2.2)
minitest (5.4.1)
minitest-reporters (1.0.5)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
parser (2.2.0.pre.4)
ast (>= 1.1, < 3.0)
slop (~> 3.4, >= 3.4.5)
powerpack (0.0.9)
rainbow (2.0.0)
rake (10.3.2)
rubocop (0.26.1)
astrolabe (~> 1.3)
parser (>= 2.2.0.pre.4, < 3.0)
powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (1.5.1)
slop (3.6.0)

PLATFORMS
ruby
Expand All @@ -24,4 +39,5 @@ DEPENDENCIES
minitest (~> 5.4)
minitest-reporters (~> 1.0)
rake (~> 10.3)
rubocop (~> 0.26)
to_boolean!
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
require 'rake/testtask'
require 'rubocop/rake_task'

desc 'Execute unit tests'
Rake::TestTask.new do |t|
t.libs << 'spec'
t.test_files = FileList['spec/spec_*.rb']
t.verbose = true
end

desc 'Execute RuboCop static code analysis'
RuboCop::RakeTask.new(:rubocop) do |t|
t.patterns = ['lib/**/*.rb']
t.fail_on_error = false
end

task :default => :test
4 changes: 3 additions & 1 deletion lib/to_boolean.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Core extension to the Object class
#
class Object
def to_boolean
value = self.is_a?(String) ? self.downcase : self
value = self.is_a?(String) ? downcase : self
[true, 'true', 1, '1'].include?(value)
end
end
5 changes: 5 additions & 0 deletions lib/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Gem version
#
module ToBoolean
VERSION = '1.0.2'
end
8 changes: 5 additions & 3 deletions to_boolean.gemspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
require_relative 'lib/version'

Gem::Specification.new do |gem|
gem.name = 'to_boolean'
gem.version = '1.0.1'
gem.version = ToBoolean::VERSION
gem.platform = Gem::Platform::RUBY
gem.authors = ['Jani Jegoroff']
gem.date = '2014-09-10'
gem.email = ['[email protected]']
gem.summary = 'Simple gem that provides to_boolean method.'
gem.description = 'Ruby core extension that converts string and integer values to boolean.'
gem.description = 'Core extension that converts string and integer values to boolean.'
gem.homepage = 'http://github.com/JaniJegoroff/to_boolean'
gem.license = 'MIT'

Expand All @@ -18,4 +19,5 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake', '~> 10.3'
gem.add_development_dependency 'minitest', '~> 5.4'
gem.add_development_dependency 'minitest-reporters', '~> 1.0'
gem.add_development_dependency 'rubocop', '~> 0.26'
end

0 comments on commit dc09dd5

Please sign in to comment.