Module: YardSequel::Associations::ToManyMethods

Included in:
OneToManyHandler
Defined in:
lib/yard-sequel/associations/modules/to_many_methods.rb

Overview

Provides methods for creating the to_many method objects.

Instance Method Summary collapse

Instance Method Details

#create_to_many_adderYARD::CodeObjects::MethodObject


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/yard-sequel/associations/modules/to_many_methods.rb', line 10

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

#create_to_many_clearerYARD::CodeObjects::MethodObject


24
25
26
27
28
29
30
31
# File 'lib/yard-sequel/associations/modules/to_many_methods.rb', line 24

def create_to_many_clearer
  name             = association_name
  method           = create_method_object "remove_all_#{name}"
  method.docstring += 'Removes the association of all '\
                      "#{association_class.pluralize} with `self`."
  void_return_tag method
  method
end

#create_to_many_getterYARD::CodeObjects::MethodObject


35
36
37
38
39
40
41
# File 'lib/yard-sequel/associations/modules/to_many_methods.rb', line 35

def create_to_many_getter
  name   = association_name
  method = create_method_object name
  return_tag(method, "Array<#{association_full_class}>",
             "the associated #{association_class.pluralize}.")
  method
end

#create_to_many_removerYARD::CodeObjects::MethodObject


45
46
47
48
49
50
51
52
53
54
55
# File 'lib/yard-sequel/associations/modules/to_many_methods.rb', line 45

def create_to_many_remover
  name             = association_name
  method           = create_method_object "remove_#{name.singularize}"
  method.docstring += 'Removes the association of the passed '\
                      "#{association_class} with `self`."
  add_param_tag(method, name.singularize, association_full_class,
                "The #{association_class} to remove the association "\
                'with `self` from.')
  void_return_tag method
  method
end