Module: UseCaseValidations::Target::ClassMethods

Defined in:
lib/usecasing_validations/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



27
28
29
# File 'lib/usecasing_validations/target.rb', line 27

def options
  @options
end

#target_symObject (readonly)

Returns the value of attribute target_sym.



27
28
29
# File 'lib/usecasing_validations/target.rb', line 27

def target_sym
  @target_sym
end

Instance Method Details

#target(target_sym, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/usecasing_validations/target.rb', line 29

def target(target_sym, options = {})
  @target_sym, @options = target_sym, options

  if options.key?(:in)
    define_method(options[:in]) { context.send(options[:in]) }
    define_method(target_sym) { send(options[:in]).send(target_sym) }
  else
    define_method(target_sym) { context.send(target_sym) }
  end
end