Module: YardSequel::Associations::ToOneMethods

Included in:
ManyToOneHandler
Defined in:
lib/yard-sequel/associations/modules/to_one_methods.rb

Overview

Provides methods for creating the to_one method objects.

Author:

  • Kai Moschcau

Instance Method Summary collapse

Instance Method Details

#create_to_one_getterYARD::CodeObjects::MethodObject


10
11
12
13
14
15
16
# File 'lib/yard-sequel/associations/modules/to_one_methods.rb', line 10

def create_to_one_getter
  name   = association_name
  method = create_method_object name
  return_tag(method, association_full_class,
             "the associated #{association_class}.")
  method
end

#create_to_one_setterYARD::CodeObjects::MethodObject


20
21
22
23
24
25
26
27
28
29
30
# File 'lib/yard-sequel/associations/modules/to_one_methods.rb', line 20

def create_to_one_setter
  name             = association_name
  method           = create_method_object "#{name}="
  method.docstring += "Associates the passed #{association_class} "\
                      'with `self`.'
  add_param_tag(method, name, association_full_class,
                "The #{association_class} to associate with `self`.")
  return_tag(method, association_full_class,
             "the associated #{association_class}.")
  method
end