Sha256: b5a6de4da2980094a333e0bb4f2f1d2aa16d686e52373b88f850ac6e62fcaab8

Contents?: true

Size: 340 Bytes

Versions: 43

Compression:

Stored size: 340 Bytes

Contents

# frozen_string_literal: true

class ValidationBuilder < Sinclair
  delegate :expected, to: :options_object

  def initialize(klass, options = {})
    super
  end

  def add_validation(field)
    add_method("#{field}_valid?", "#{field}.is_a?#{expected}")
  end

  def add_accessors(fields)
    klass.send(:attr_accessor, *fields)
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/support/models/validator_builder.rb
sinclair-2.1.0 spec/support/models/validator_builder.rb
sinclair-2.0.1 spec/support/models/validator_builder.rb
sinclair-2.0.0 spec/support/models/validator_builder.rb
sinclair-1.16.3 spec/support/models/validator_builder.rb
sinclair-1.16.2 spec/support/models/validator_builder.rb
sinclair-1.16.1 spec/support/models/validator_builder.rb
sinclair-1.16.0 spec/support/models/validator_builder.rb
sinclair-1.15.0 spec/support/models/validator_builder.rb
sinclair-1.14.2 spec/support/models/validator_builder.rb
sinclair-1.14.1 spec/support/models/validator_builder.rb
sinclair-1.14.0 spec/support/models/validator_builder.rb
sinclair-1.13.0 spec/support/models/validator_builder.rb
sinclair-1.12.1 spec/support/models/validator_builder.rb
sinclair-1.12.0 spec/support/models/validator_builder.rb
sinclair-1.11.0 spec/support/models/validator_builder.rb
sinclair-1.10.0 spec/support/models/validator_builder.rb
sinclair-1.9.0 spec/support/models/validator_builder.rb
sinclair-1.8.0 spec/support/models/validator_builder.rb
sinclair-1.7.0 spec/support/models/validator_builder.rb