lib/packer/dataobject.rb in packer-config-0.0.3 vs lib/packer/dataobject.rb in packer-config-0.0.4

- old
+ new

@@ -13,11 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. module Packer class DataObject - attr_accessor :data attr_accessor :required def initialize self.data = {} @@ -69,19 +68,19 @@ end def __add_array_of_strings(key, values, exclusives = []) self.__exclusive_key_error(key, exclusives) raise TypeError.new() unless Array.try_convert(values) - self.data[key.to_s] = values.to_ary.map{ |c| c.to_s } + self.data[key.to_s] = values.to_ary.map(&:to_s) end def __add_array_of_array_of_strings(key, values, exclusives = []) self.__exclusive_key_error(key, exclusives) raise TypeError.new() unless Array.try_convert(values) self.data[key.to_s] = [] values.each do |v| raise TypeError.new() unless Array.try_convert(v) - self.data[key.to_s].push(v.to_ary.map{ |c| c.to_s }) + self.data[key.to_s].push(v.to_ary.map(&:to_s)) end end def __add_array_of_hashes(key, values, exclusives = []) self.__exclusive_key_error(key, exclusives)