From 9523c667264cd17bc4ac036f734d219bba73626c Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sat, 7 Sep 2013 20:27:06 +0200 Subject: [PATCH] Use 1.9 style hash syntax where possible --- config/rubocop.yml | 4 ---- lib/mutant/cli.rb | 16 ++++++++-------- lib/mutant/cli/classifier/method.rb | 2 +- lib/mutant/matcher/methods.rb | 2 +- lib/mutant/mutator/node/connective/binary.rb | 4 ++-- lib/mutant/mutator/node/literal/boolean.rb | 4 ++-- lib/mutant/mutator/node/literal/range.rb | 4 ++-- .../node/named_value/variable_assignment.rb | 8 ++++---- lib/mutant/mutator/node/send.rb | 4 ++-- lib/mutant/strategy/rspec.rb | 6 +++--- 10 files changed, 25 insertions(+), 29 deletions(-) diff --git a/config/rubocop.yml b/config/rubocop.yml index 2a4e4a10..ef37a8d6 100644 --- a/config/rubocop.yml +++ b/config/rubocop.yml @@ -80,10 +80,6 @@ ConstantName: TrivialAccessors: Enabled: false -# I like 1.8 syntax: -HashSyntax: - Enabled: false - # And also have a differend opinion here AndOr: Enabled: false diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index a226839d..77c93f11 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -58,14 +58,14 @@ module Mutant # def config Config.new( - :cache => @cache, - :zombie => @zombie, - :debug => debug?, - :matcher => matcher, - :filter => filter, - :fail_fast => @fail_fast, - :strategy => strategy, - :reporter => reporter + cache: @cache, + zombie: @zombie, + debug: debug?, + matcher: matcher, + filter: filter, + fail_fast: @fail_fast, + strategy: strategy, + reporter: reporter ) end memoize :config diff --git a/lib/mutant/cli/classifier/method.rb b/lib/mutant/cli/classifier/method.rb index 4abfbeee..ae8e4197 100644 --- a/lib/mutant/cli/classifier/method.rb +++ b/lib/mutant/cli/classifier/method.rb @@ -50,7 +50,7 @@ module Mutant method.name == method_name end or raise NameError, "Cannot find method #{identifier}" end - memoize :method, :freezer => :noop + memoize :method, freezer: :noop # Return scope name # diff --git a/lib/mutant/matcher/methods.rb b/lib/mutant/matcher/methods.rb index 6bd05cc1..11916c50 100644 --- a/lib/mutant/matcher/methods.rb +++ b/lib/mutant/matcher/methods.rb @@ -117,7 +117,7 @@ module Mutant def candidate_scope scope.singleton_class end - memoize :candidate_scope, :freezer => :noop + memoize :candidate_scope, freezer: :noop end # Singleton diff --git a/lib/mutant/mutator/node/connective/binary.rb b/lib/mutant/mutator/node/connective/binary.rb index df0c3a8c..aa92d61d 100644 --- a/lib/mutant/mutator/node/connective/binary.rb +++ b/lib/mutant/mutator/node/connective/binary.rb @@ -9,8 +9,8 @@ module Mutant class Binary < Node INVERSE = { - :and => :or, - :or => :and, + and: :or, + or: :and }.freeze handle(*INVERSE.keys) diff --git a/lib/mutant/mutator/node/literal/boolean.rb b/lib/mutant/mutator/node/literal/boolean.rb index 5c1717af..6ed6e652 100644 --- a/lib/mutant/mutator/node/literal/boolean.rb +++ b/lib/mutant/mutator/node/literal/boolean.rb @@ -10,8 +10,8 @@ module Mutant private MAP = { - :true => :false, - :false => :true + true: :false, + false: :true }.freeze handle(*MAP.keys) diff --git a/lib/mutant/mutator/node/literal/range.rb b/lib/mutant/mutator/node/literal/range.rb index 5864d39d..52d146ce 100644 --- a/lib/mutant/mutator/node/literal/range.rb +++ b/lib/mutant/mutator/node/literal/range.rb @@ -10,8 +10,8 @@ module Mutant include AbstractType MAP = { - :irange => :erange, - :erange => :irange + irange: :erange, + erange: :irange }.freeze children :start, :_end diff --git a/lib/mutant/mutator/node/named_value/variable_assignment.rb b/lib/mutant/mutator/node/named_value/variable_assignment.rb index 3e55dbcf..b9e03586 100644 --- a/lib/mutant/mutator/node/named_value/variable_assignment.rb +++ b/lib/mutant/mutator/node/named_value/variable_assignment.rb @@ -11,10 +11,10 @@ module Mutant children :name, :value MAP = IceNine.deep_freeze( - :gvasgn => '$', - :cvasgn => '@@', - :ivasgn => '@', - :lvasgn => '' + gvasgn: '$', + cvasgn: '@@', + ivasgn: '@', + lvasgn: '' ) handle(*MAP.keys) diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index 0d0dbf17..d054798a 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -12,8 +12,8 @@ module Mutant children :receiver, :selector SELECTOR_REPLACEMENTS = { - :send => :public_send, - :gsub => :sub + send: :public_send, + gsub: :sub }.freeze INDEX_REFERENCE = :[] diff --git a/lib/mutant/strategy/rspec.rb b/lib/mutant/strategy/rspec.rb index c8060e66..08d9cf09 100644 --- a/lib/mutant/strategy/rspec.rb +++ b/lib/mutant/strategy/rspec.rb @@ -33,7 +33,7 @@ module Mutant def configuration RSpec::Core::Configuration.new end - memoize :configuration, :freezer => :noop + memoize :configuration, freezer: :noop # Return example groups # @@ -56,7 +56,7 @@ module Mutant def world RSpec.world end - memoize :world, :freezer => :noop + memoize :world, freezer: :noop # Return options # @@ -69,7 +69,7 @@ module Mutant options.parse_options options end - memoize :options, :freezer => :noop + memoize :options, freezer: :noop end # Rspec end # Strategy