1
votes

I am trying to create a LWRP to extend a supermarket cookbook 'webpshere'.

In my resource file, I am trying to extend this class with a base class found in parent cook book.

In the code below, 'WebsphereBase' is defined in the parent library 'websphere_base'. Can I get help on how to reference it? Thanks

    #require 'websphere_base'
    module PIWebsphereCookBook
    class WebsphereJbdc < WebsphereBase
    require_relative 'helper'
2

2 Answers

1
votes

In the source of the cookbook, you can see that the WebsphereBase class is defined inside the WebsphereCookbook module.

To reference this class from outside this module, you have to name the nesting so that Ruby is able to find the class you are referring to. With youur example, this can look similar to:

module PIWebsphereCookBook
  class WebsphereJbdc < WebsphereCookbook::WebsphereBase
    require_relative 'helper'
    # ...
  end
end
1
votes

You don't need to require things coming from upstream cookbooks, nor can you (except for my weirdo cookbooks). All libs for cookbooks you depend on will be loaded by the time your library files run.