Sha256: 72100637496e6f51d5e333a2d0bd4c2bd9d2fc9f8dbb8f61612ceac8043ab9d1

Contents?: true

Size: 307 Bytes

Versions: 1

Compression:

Stored size: 307 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
sinclair-1.1.1 spec/support/models/validator_builder.rb