summaryrefslogtreecommitdiff
path: root/lib/chef/property.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-03-21 14:51:46 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-03-21 14:51:46 -0700
commitd23db7c88801551ef92af553764d0a38cc5d75f5 (patch)
tree64c147b77dd5c9edcacd94715c5da7061bacc1d1 /lib/chef/property.rb
parent3099264e4e44c4615622f1d69fc040a5d4d90500 (diff)
downloadchef-d23db7c88801551ef92af553764d0a38cc5d75f5.tar.gz
Chef-13: Simplify DSL creation
we did actually have tests around creating actions with spaces and hyphens in their names. we had fallback code for properties, but it was broken and threw a "private method define_resource called" and then it created a closure and didn't have the `name` in the binding so it called itself and blew up the stack. this change walks that back. it does prove that we still support UTF-8 in property names, actions and DSL names, which i'd argue is more than enough. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/property.rb')
-rw-r--r--lib/chef/property.rb10
1 files changed, 0 insertions, 10 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb
index 9f8fa599e5..c6f72e15a7 100644
--- a/lib/chef/property.rb
+++ b/lib/chef/property.rb
@@ -515,16 +515,6 @@ class Chef
self.class.properties[#{name.inspect}].set(self, value)
end
EOM
- rescue SyntaxError
- # If the name is not a valid ruby name, we use define_method.
- declared_in.define_method(name) do |value = NOT_PASSED, &block|
- raise "Property `#{name}` of `#{self}` was incorrectly passed a block! Possible property-resource collision. To call a resource named `#{name}` either rename the property or else use `declare_resource(:#{name}, ...)`" if block
- self.class.properties[name].call(self, value)
- end
- declared_in.define_method("#{name}=") do |value, &block|
- raise "Property `#{name}` of `#{self}` was incorrectly passed a block! Possible property-resource collision. To call a resource named `#{name}` either rename the property or else use `declare_resource(:#{name}, ...)`" if block
- self.class.properties[name].set(self, value)
- end
end
#