# File lib/chef/resource.rb, line 457 def attribute(attr_name, validation_opts={}) # This atrocity is the only way to support 1.8 and 1.9 at the same time # When you're ready to drop 1.8 support, do this: # define_method attr_name.to_sym do |arg=nil| # etc. shim_method="def \#{attr_name}(arg=nil)\n_set_or_return_\#{attr_name}(arg)\nend\n" class_eval(shim_method) define_method("_set_or_return_#{attr_name.to_s}".to_sym) do |arg| set_or_return(attr_name.to_sym, arg, validation_opts) end end