Sha256: a102232aba7c2ceb5d00be13f8167956e6ceaa8bafb74853c39d8e1a253d7d72

Contents?: true

Size: 416 Bytes

Versions: 1

Compression:

Stored size: 416 Bytes

Contents

require "active_support/concern"

# Enable a simplified API for the common case of
# read-only ValidatedObjects.
module ValidatedObject
  module SimplifiedApi
    extend ActiveSupport::Concern

    class_methods do
      # Simply delegate to `attr_reader` and `validates`.
      def validated_attr(attribute, *options)
        attr_reader attribute
        validates attribute, *options
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
validated_object-2.3.0 lib/validated_object/simplified_api.rb