0

I would like to know how would I go about accessing the methods in this module from another .rb file

module Decisioning
  module Decision
    class OfferProxy < FinanceApplication::Offer

    def my_method
     "some value"
    end

  end
 end
end

So how would I access my_method from another .rb file?

maby something like

include ::Decisioning::Decision::OfferProxy

can I then use

my_method

1 Answer 1

2

Probably more like this:

module Decisioning
  module Decision
    class OfferProxy

    def self.my_method
     "some value"
    end

  end
 end
end

class TestFile

  include Decisioning::Decision

  def test
    puts OfferProxy.my_method
  end

end

TestFile.new.test

Or...

module Decisioning
  module Decision
    class OfferProxy

    def my_method
     "some value"
    end

  end
 end
end

class TestFile

  include Decisioning::Decision

  def test
    offer_proxy = OfferProxy.new
    puts offer_proxy.my_method
  end

end

TestFile.new.test
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.