Hello, I need to extend a plugin by overwriting a method and adding one of my own. So far I have followed Strictly Untyped's guide for this but I haven't had much success. Basically there is a file in the initializer folder that loads the extension from the lib directory.
In my initializers folder I have a file with this:
require 'amazon_extensions/question_generator_extendors.rb'
require 'amazon/webservices/mturk/question_generator.rb'
Amazon::WebServices::MTurk::QuestionGenerator.class_eval do
include Amazon::QuestionGeneratorExtendors
end
Where I load the original class that I want to extend and then include my extension (Amazon::QuestionGeneratorExtendors)
Then in the lib/ directory I have a amazon_extensions folder that contains question_generator_extendors.rb:
module Amazon
module QuestionGeneratorExtendors
def self.included(base)
base.class_eval {include InstanceMethods}
end
module InstanceMethods
def ask(*args)
case @type
when :Basic
askBasic( args.join )
when :Formatted
askFormatted( args.join )
end
end
def askFormatted(text)
id = "FormattedQuestion#{@questions.size+1}"
question = REXML::Element.new 'FormattedContent'
...
end
end
end
end
But when I try and run this it still will not recognize my changes. Any thoughts?