can you count the letter "l" in:
q: using chef server, what is a good pattern for removing duplicate calls to a particular resource? i have a recipe with multiple calls to a given resource, let's say directory. the calls to directory, for the most part, have very similar parameters (i.e. same owner, same action, etc.) - i.e. a lot of duplication. however, there is a particular parameter that changes frequently, namely the mode.
my goal is to reduce the duplication in my recipes and create something of a convenience method.
i'm leaning towards creating a library with a method like this:
def apply_directory_rule(path, mode_num)
  directory path do
    owner "something"
    group "something_else"
    mode mode_num
    action :create
  end
end

then, in the recipe, each time i wanted to create a directory for the applications, i would simply call the following:
applications.each do |application|
  apply_directory_rule "#{application}/shared", 0755
end

i have not been able to test this yet, but i guess my main question is whether or not resources, in this case directory are available like this in libraries? secondarily, i'm not convinced this is the best pattern - any suggestions to reduce this duplication in my recipes is appreciated!

a: you can simply define a method in a recipe, and use it in that recipe. it's simple and gets the job done.
if you need to reuse the pattern in different recipes, or just want to use more "chef-y" approach, there are two tools specifically for this.
in simple cases, you can use definitions; more complex situations require writing your own lightweight resource and provider (lwrp). both are usable in other recipes and in other cookbooks.
you can read a good writeup on creating lwrps here: 
http://dougireton.com/blog/2012/12/31/creating-an-lwrp/,
http://dougireton.com/blog/2013/01/07/creating-an-lwrp-part-2/,
http://dougireton.com/blog/2013/01/13/creating-an-lwrp-part-3/.

user
There are sixty-one "l"s in the text you provided.
assistant