I have a module file located in the vendor / plugins folder.
module Greetings
def self.greet(message)
return "good morning" if message=="gm"
return "evening" if message=="ge"
return "good afternoon" if message=="ga"
end
end
When I do Greetings.greet("ge"), I get "evening" as an outlet. I want to change this behavior without changing the aforementioned Greetings module (the obvious reason is that its external plugin).
My question here is simple. What should I do, when I call Greetings.greet("ge"), it should return βVery Good Eveningβ to me and for all other inputs, it should return what the original module returns.
And I would write this inside the config / initializers folder, since I use Rails.
PS: I have already raised a similar question for classes. But I really want to know how this works for modules.
source
share