How to use library module in Cookbook recipes
<p>In a cookbook I have a library(<strong>client_helper.rb</strong>). A module is defined inside it. Module name is <strong>Client_helper</strong>. Here is the module code.</p>

<pre><code>module Client_helper
# This module contains helper methods

def network_zone
        Chef::Log.debug('network zone called...********')
        Chef::Log.debug("inside-::::"+self.class.to_s)
end    

end
Chef::Recipe.send(:include, Client_helper)
</code></pre>

<p>Now I have <strong>default</strong> recipe. Where I am calling the method <strong>network_zone</strong> from direct recipe it is working. </p>

<p>But when I am calling the method network_zone inside <strong>ruby_block(eg. Client_helper.network_zone) it is not working</strong>. </p>

<p>Please find the recipe code.</p>

<pre><code># Cookbook: client
# Recipe: default

Chef::Resource.send(:include, Sap_splunk_client_helper)   


  host_network_zone = network_zone # This is working

Log.info("inside-::::"+self.class.to_s)

ruby_block 'parse auto generated templates' do
  block do
    host_network_zone = Client_helper.network_zone #This is not working
    Log.info("inside ruby block-::::"+self.class.to_s)
end
end
</code></pre>

<p>My cookbook directory structure-</p>

<p><a href="https://i.stack.imgur.com/jEFvN.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/jEFvN.jpg" alt="enter image description here"></a></p>

<p>Please help me. </p>