Skip to content

Commit

Permalink
NoTask - Fixed rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benSlaughter committed Jan 3, 2018
1 parent 672ae19 commit 71d5608
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Metrics/BlockLength:
Exclude:
- 'spec/**/*_spec.rb'

Style/SymbolProc:
Lint/BooleanSymbol:
Exclude:
- 'lib/utilise/augment/hash.rb'
- 'spec/utilise/array_spec.rb'
- 'spec/utilise/hash_spec.rb'
- 'spec/utilise/object_spec.rb'
- 'spec/utilise/symbol_spec.rb'
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require 'rubocop/rake_task'
require 'yard'

RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w(--color --format progress)
t.rspec_opts = %w[--color --format progress]
end

RuboCop::RakeTask.new(:rubocop) do |t|
Expand All @@ -24,4 +24,4 @@ task :version do
puts Utilise.version(true)
end

task default: %w(rubocop spec)
task default: %w[rubocop spec]
10 changes: 5 additions & 5 deletions lib/utilise/augment/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ module Augment
module Hash
# Transforms all keys to snake case
def snake_keys
utilise_deep_transform_keys(self) { |key| key.snake }
utilise_deep_transform_keys(self, &:snake)
end

# Transforms all keys to camel case
def camel_keys
utilise_deep_transform_keys(self) { |key| key.camel }
utilise_deep_transform_keys(self, &:camel)
end

# Transforms all keys to space case
def space_keys
utilise_deep_transform_keys(self) { |key| key.space }
utilise_deep_transform_keys(self, &:space)
end

# Transforms all keys to a string
def string_keys
utilise_deep_transform_keys(self) { |key| key.to_s }
utilise_deep_transform_keys(self, &:to_s)
end

# Transforms all keys to a symbol
def symbol_keys
utilise_deep_transform_keys(self) { |key| key.to_sym }
utilise_deep_transform_keys(self, &:to_sym)
end

private
Expand Down
9 changes: 6 additions & 3 deletions lib/utilise/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ module Utilise
# The version update date
DATE = '2017-02-07'.freeze
# Debug output message
MSG = 'Version %s %s (running on %s-%s)'.freeze
MSG = 'Version %<version>s %<date>s (running on %<engine>s-%<ruby>s)'.freeze

module_function

# Outputs the current gem version
def version(debug = false)
if debug
format(MSG, VERSION, DATE, RUBY_ENGINE,
RUBY_VERSION)
format(MSG,
version: VERSION,
date: DATE,
engine: RUBY_ENGINE,
ruby: RUBY_VERSION)
else
VERSION
end
Expand Down
5 changes: 3 additions & 2 deletions utilise.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'utilise/version'

TRAVIS_VERSION = "#{Utilise::VERSION}-#{ENV['TRAVIS_BUILD_NUMBER']}".freeze

Gem::Specification.new do |spec|
spec.name = 'utilise'
spec.summary = 'Utilises a few extra methods'
spec.description = 'Extends a few ruby classes with helpful methods'
spec.homepage = 'http://benslaughter.github.io/utilise/'
spec.version = Utilise::VERSION
spec.version = "#{spec.version}-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
spec.version = ENV['TRAVIS'] ? TRAVIS_VERSION : Utilise::VERSION
spec.date = Utilise::DATE
spec.license = 'MIT'

Expand Down

0 comments on commit 71d5608

Please sign in to comment.