Module: UseCaseValidations::Target::ClassMethods

Defined in:
lib/usecasing_validations/target.rb

Instance Method Summary collapse

Instance Method Details

#optionsObject



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

def options
  Helpers._get_instance_variable(self, :options, {})
end

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



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

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

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

#target_nameObject



23
24
25
# File 'lib/usecasing_validations/target.rb', line 23

def target_name
  Helpers._get_instance_variable(self, :target_name, nil)
end