module YardSequel::Associations::ToManyMethods

Provides methods for creating the to_many method objects. @author Kai Moschcau

Public Instance Methods

create_to_many_adder() click to toggle source

@return [YARD::CodeObjects::MethodObject] the to_many adder method

object.
# 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_clearer() click to toggle source

@return [YARD::CodeObjects::MethodObject] the to_many clearer

method object.
# 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_getter() click to toggle source

@return [YARD::CodeObjects::MethodObject] the to_many getter

method object.
# 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_remover() click to toggle source

@return [YARD::CodeObjects::MethodObject] the to_many remover

method object.
# 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