Module: Ronin::Model::HasAuthors::ClassMethods

Defined in:
lib/ronin/model/has_authors.rb

Overview

Class methods that are added when Ronin::Model::HasAuthors is included into a model.

Instance Method Summary collapse

Instance Method Details

#written_by(name) ⇒ Array<Model>

Finds all resources associated with a given author.

Parameters:

  • name (String)

    The name of the author.

Returns:

  • (Array<Model>)

    The resources written by the author.



67
68
69
# File 'lib/ronin/model/has_authors.rb', line 67

def written_by(name)
  all('authors.name.like' => "%#{name}%")
end

#written_for(name) ⇒ Array<Model>

Finds all resources associated with a given organization.

Parameters:

  • name (String)

    The name of the organization.

Returns:

  • (Array<Model>)

    The resources associated with the organization.



82
83
84
# File 'lib/ronin/model/has_authors.rb', line 82

def written_for(name)
  all('authors.organization.like' => "%#{name}%")
end