Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 2 additions & 5 deletions lib/antonym_predicates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions spec/antonym_predicates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down