class Attributor::HashDSLCompiler

Public Instance Methods

_requirements_dsl() click to toggle source
# File lib/attributor/hash_dsl_compiler.rb, line 123
def _requirements_dsl
  @requirements_dsl ||= RequiresDSL.new(@target)
end
requires(*spec, **opts, &block) click to toggle source
# File lib/attributor/hash_dsl_compiler.rb, line 127
def requires(*spec, **opts, &block)
  if spec.empty?
    _requirements_dsl.options.merge(opts) unless opts.empty?
    if block_given?
      _requirements_dsl.instance_eval(&block)
    else
      _requirements_dsl
    end
  else
    _requirements_dsl.all(*spec, **opts)
  end
end