Sha256: 8adcc8b63f867bd49317adec1d2f402d87143b979228cbb4855a1d292bb1b5dd

Contents?: true

Size: 673 Bytes

Versions: 20

Compression:

Stored size: 673 Bytes

Contents

require 'representable/json/collection'
require 'representable/json/hash'

# Represents a validators hash for a model.
module ValidatorsRepresenter
  class ValidatorClient
    attr_accessor :kind, :options
  end
  
  # Represents a single Validator instance.
  module ValidatorRepresenter
    include Roar::Representer::JSON
    property :kind
    hash :options
  end
  
  # Represents an array of validators for an attribute.
  module AttributeValidators
    include Representable::JSON::Collection
    items :extend => ValidatorRepresenter, :class => ValidatorClient
  end

  include Representable::JSON::Hash
  values :extend => AttributeValidators, :class => Array
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
roar-rails-0.1.6 lib/roar/rails/validations_representer.rb
roar-rails-0.1.5 lib/roar/rails/validations_representer.rb
roar-rails-0.1.4 lib/roar/rails/validations_representer.rb
roar-rails-0.1.3 lib/roar/rails/validations_representer.rb
roar-rails-0.1.2 lib/roar/rails/validations_representer.rb
roar-rails-0.1.1 lib/roar/rails/validations_representer.rb
roar-rails-0.1.0 lib/roar/rails/validations_representer.rb
roar-rails-0.0.15 lib/roar/rails/validations_representer.rb
roar-rails-0.0.14 lib/roar/rails/validations_representer.rb
roar-rails-0.0.13 lib/roar/rails/validations_representer.rb
roar-rails-0.0.12 lib/roar/rails/validations_representer.rb
roar-rails-0.0.11 lib/roar/rails/validations_representer.rb
roar-rails-0.0.10 lib/roar/rails/validations_representer.rb
roar-rails-0.0.9 lib/roar/rails/validations_representer.rb
roar-rails-0.0.8 lib/roar/rails/validations_representer.rb
roar-rails-0.0.7 lib/roar/rails/validations_representer.rb
roar-rails-0.0.6 lib/roar/rails/validations_representer.rb
roar-rails-0.0.5 lib/roar/rails/validations_representer.rb
roar-rails-0.0.4 lib/roar/rails/validations_representer.rb
roar-rails-0.0.3 lib/roar/rails/validations_representer.rb