diff options
author | John Keiser <john@johnkeiser.com> | 2015-06-30 12:58:07 -0600 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-07-03 13:10:23 -0600 |
commit | d08645c68967630030bc70934899e092744487d1 (patch) | |
tree | cc88c631539d54400661acba100b24a153b077d0 /lib/chef/property.rb | |
parent | 28f17b36a9d041be8ed50e20ae06fa5f5ea1fb38 (diff) | |
download | chef-d08645c68967630030bc70934899e092744487d1.tar.gz |
Code review comments
Diffstat (limited to 'lib/chef/property.rb')
-rw-r--r-- | lib/chef/property.rb | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 8d160d7539..17554c5661 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -1,3 +1,21 @@ +# +# Author:: John Keiser <jkeiser@chef.io> +# Copyright:: Copyright (c) 2015 John Keiser. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + require 'chef/exceptions' require 'chef/delayed_evaluator' @@ -381,6 +399,8 @@ class Chef protected + attr_reader :options + # # Find out whether this type accepts nil explicitly. # @@ -423,7 +443,7 @@ class Chef def get_value(resource) if instance_variable_name - resource.send(:instance_variable_get, instance_variable_name) + resource.instance_variable_get(instance_variable_name) else resource.send(name) end @@ -431,7 +451,7 @@ class Chef def set_value(resource, value) if instance_variable_name - resource.send(:instance_variable_set, instance_variable_name, value) + resource.instance_variable_set(instance_variable_name, value) else resource.send(name, value) end @@ -439,7 +459,7 @@ class Chef def value_is_set?(resource) if instance_variable_name - resource.send(:instance_variable_defined?, instance_variable_name) + resource.instance_variable_defined?(instance_variable_name) else true end @@ -448,7 +468,7 @@ class Chef def reset_value(resource) if instance_variable_name if value_is_set?(resource) - resource.send(:remove_instance_variable, instance_variable_name) + resource.remove_instance_variable(instance_variable_name) end else raise ArgumentError, "Property #{name} has no instance variable defined and cannot be reset" @@ -473,8 +493,6 @@ class Chef value end - attr_reader :options - # Used by #set_or_return to avoid emitting a deprecation warning for # "value nil" # @api private |