From 03244688bd1d4ee10228b3612f02cfbf67c0a27c Mon Sep 17 00:00:00 2001 From: Everton Moreth Date: Tue, 1 Feb 2011 23:37:51 -0200 Subject: [PATCH 1/3] Typo --- README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index 8aecdaa..39cb8f1 100644 --- a/README.rdoc +++ b/README.rdoc @@ -11,7 +11,7 @@ The only thing that you need to configure is the dictionary. Include any antonym AntonymPredicates.antonyms = { "equal" => "different", "is_a" => "isnt_a", - "respond_to" => "doesnt_respont_to" + "respond_to" => "doesnt_respond_to" } Then you can generate antonym methods doing the following: From bdd0893417e338fb98f81ce79edd8d3d62fac73c Mon Sep 17 00:00:00 2001 From: Everton Moreth Date: Tue, 1 Feb 2011 23:54:05 -0200 Subject: [PATCH 2/3] Syntax sugar --- lib/antonym_predicates.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/antonym_predicates.rb b/lib/antonym_predicates.rb index ae1c5dc..6fd4eea 100644 --- a/lib/antonym_predicates.rb +++ b/lib/antonym_predicates.rb @@ -2,13 +2,10 @@ module AntonymPredicates @antonyms ||= {} - def self.antonyms - @antonyms + class << self + attr_accessor :antonyms end - def self.antonyms=(antonyms) - @antonyms = antonyms - end # @antonyms = { # "equal" => "different", From 2ef49ad00d0880e9301e932283c58ed0bb5a9de6 Mon Sep 17 00:00:00 2001 From: Everton Moreth Date: Tue, 1 Feb 2011 23:56:58 -0200 Subject: [PATCH 3/3] Test methods name refactor --- spec/antonym_predicates_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/antonym_predicates_spec.rb b/spec/antonym_predicates_spec.rb index 109a69b..79942ed 100644 --- a/spec/antonym_predicates_spec.rb +++ b/spec/antonym_predicates_spec.rb @@ -5,11 +5,11 @@ before(:each) do class MyClass - def self.something? + def self.something_true? true end - def otherthing? + def something_false? false end @@ -29,11 +29,11 @@ def up? it 'should be able to generate antonym methods with "not_method?" form, for both class and instance' do AntonymPredicates.generate_antonyms MyClass - MyClass.should respond_to :not_something? - MyClass.not_something?.should be_false + MyClass.should respond_to :not_something_true? + MyClass.not_something_true?.should be_false obj = MyClass.new - obj.should respond_to :not_otherthing? - obj.not_otherthing?.should be_true + obj.should respond_to :not_something_false? + obj.not_something_false?.should be_true end it "should be able to generate antonym methods from dictionary, for both class and instance" do @@ -57,7 +57,7 @@ def self.someone? end end AntonymPredicates.generate_antonyms MyClass, MyOtherClass - MyClass.should respond_to :not_something? + MyClass.should respond_to :not_something_true? MyOtherClass.should respond_to :not_someone? end