Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Created March 17, 2014 13:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwilczynski/9598879 to your computer and use it in GitHub Desktop.
Save kwilczynski/9598879 to your computer and use it in GitHub Desktop.
Monkey-patch Chef::Node#role? method so it can search through an array.
class Chef
class Node
def role?(argument)
if argument.is_a? Array
argument.detect {|r| run_list.include? "role[#{r}]" } ? true : false
else
argument.include? "role[#{argument}]"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment