title: Chef: Use library function in attributes
body: <p>How can I access an own library function (created in the following module) in a cookbook's attribute file?</p>
  
  <pre class="lang-rb prettyprint-override"><code>module Gerrit
    module Helpers
      def gerrit_above?(version)
        require 'chef/version_constraint'
        Chef::VersionConstraint.new("&gt;= #{version}").include?(node['gerrit']['version'])
      end
    end
  end
  
  Chef::Recipe.send(:include, ::Gerrit::Helpers)
  Chef::Resource.send(:include, ::Gerrit::Helpers)
  Chef::Provider.send(:include, ::Gerrit::Helpers)
  </code></pre>
  
  <p>I can access it in recipes through <code>gerrit_above?</code>, but didn't find a way to make it at the same time usable in an attributes file. I tried the following line</p>
  
  <pre><code>Chef::Node::Attribute.send(:include, ::Gerrit::Helpers)
  </code></pre>
  
  <p>But then it fails while accessing <code>node</code> with:</p>
  
  <pre><code>Undefined method or attribute `node' on `node'
  </code></pre>
  
  <p>Has anyone a clean solution?</p>