Sha256: 86a09a1490ea86344181aabe3db4c313f46bd8e384bbf6319c2f870b47337844

Contents?: true

Size: 473 Bytes

Versions: 2

Compression:

Stored size: 473 Bytes

Contents

##
# Takes a resource and a hash with properties as the keys and validators as the
# values and decorates those validations onto the resource.
module ComposedValidations
  class DecorateProperties
    pattr_initialize :resource, :property_mapper

    def run
      temp_resource = resource
      property_mapper.to_a.map{|x| PropertyValidator.new(*x) }.each do |p|
        temp_resource = p.decorate_resource(temp_resource)
      end
      temp_resource
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
composed_validations-0.0.2 lib/composed_validations/decorate_properties.rb
composed_validations-0.0.1 lib/composed_validations/decorate_properties.rb