diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-12-01 16:51:10 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-12-02 13:41:33 -0800 |
commit | 0f19729e1ec029edb17c68f1d5ac4fd472b18ee7 (patch) | |
tree | fe24a838cffdfd00543f04f7ea23ccd76eb6c5ad | |
parent | 602e09a72c6617ee01ca3febb519d3fd36bd2b8c (diff) | |
download | chef-0f19729e1ec029edb17c68f1d5ac4fd472b18ee7.tar.gz |
just use extend
-rw-r--r-- | lib/chef/mixin/subclass_directive.rb | 23 | ||||
-rw-r--r-- | lib/chef/provider/package.rb | 2 |
2 files changed, 10 insertions, 15 deletions
diff --git a/lib/chef/mixin/subclass_directive.rb b/lib/chef/mixin/subclass_directive.rb index c0c7aa0328..0f386b6cb2 100644 --- a/lib/chef/mixin/subclass_directive.rb +++ b/lib/chef/mixin/subclass_directive.rb @@ -19,22 +19,17 @@ class Chef module Mixin module SubclassDirective - def self.included(base) - base.extend(ClassMethods) - end - module ClassMethods - def subclass_directive(sym) - define_singleton_method sym do - instance_variable_set(:"@#{sym}", true) - end + def subclass_directive(sym) + define_singleton_method sym do + instance_variable_set(:"@#{sym}", true) + end - define_singleton_method :"#{sym}?" do - !!instance_variable_get(:"@#{sym}") - end + define_singleton_method :"#{sym}?" do + !!instance_variable_get(:"@#{sym}") + end - define_method :"#{sym}?" do - self.class.send(:"#{sym}?") - end + define_method :"#{sym}?" do + self.class.send(:"#{sym}?") end end end diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb index c78d125f96..abb181c571 100644 --- a/lib/chef/provider/package.rb +++ b/lib/chef/provider/package.rb @@ -28,7 +28,7 @@ class Chef class Package < Chef::Provider include Chef::Mixin::Command include Chef::Mixin::ShellOut - include Chef::Mixin::SubclassDirective + extend Chef::Mixin::SubclassDirective # subclasses declare this if they want all their arguments as arrays of packages and names subclass_directive :use_multipackage_api |