Bump up Rubocop to 0.24.1

This commit is contained in:
Peter M. Goldstein 2014-07-06 14:56:20 -07:00
parent 529be67f4c
commit 8f512086fe
6 changed files with 16 additions and 19 deletions

View File

@ -8,4 +8,4 @@ end
gemspec
gem 'rubocop', '0.21.0'
gem 'rubocop', '0.24.1'

View File

@ -10,6 +10,6 @@ RSpec::Core::RakeTask.new do |spec|
end
require 'rubocop/rake_task'
Rubocop::RakeTask.new(:rubocop)
RuboCop::RakeTask.new(:rubocop)
task default: [:rubocop, :spec]

View File

@ -16,7 +16,7 @@ module Hashie
def deep_fetch(*args, &block)
args.reduce(self) do |obj, arg|
begin
arg = Integer(arg) if obj.kind_of? Array
arg = Integer(arg) if obj.is_a? Array
obj.fetch(arg)
rescue ArgumentError, IndexError, NoMethodError => e
break block.call(arg) if block

View File

@ -31,9 +31,8 @@ module Hashie
module IgnoreUndeclared
def initialize_attributes(attributes)
attributes.each_pair do |att, value|
if self.class.property?(att) || (self.class.respond_to?(:translations) && self.class.translations.include?(att.to_sym))
self[att] = value
end
next unless self.class.property?(att) || (self.class.respond_to?(:translations) && self.class.translations.include?(att.to_sym))
self[att] = value
end if attributes
end

View File

@ -78,14 +78,13 @@ module Hashie
# see if any of the regexps match the string
@regexes.each do |regex|
match = regex.match(query)
if match
@regex_counts[regex] += 1
value = @hash[regex]
if value.respond_to? :call
yield value.call(match)
else
yield value
end
next unless match
@regex_counts[regex] += 1
value = @hash[regex]
if value.respond_to? :call
yield value.call(match)
else
yield value
end
end
@ -110,10 +109,9 @@ module Hashie
private
def optimize_if_necessary!
if (@lookups += 1) >= @optimize_every
@regexes = @regex_counts.sort_by { |_, count| -count }.map { |regex, _| regex }
@lookups = 0
end
return unless (@lookups += 1) >= @optimize_every
@regexes = @regex_counts.sort_by { |_, count| -count }.map { |regex, _| regex }
@lookups = 0
end
end
end

View File

@ -10,7 +10,7 @@ describe Hashie::Rash do
1 => 'awesome',
1..1000 => 'rangey',
/(bcd)/ => proc { |m| m[1] }
# /.+/ => "EVERYTHING"
# /.+/ => "EVERYTHING"
)
end