Class: Vedeu::Groups

Inherits:
Repository show all
Defined in:
lib/vedeu/repositories/repositories/groups.rb

Overview

Allows the storing of view groups.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Store

#each, #empty?, #exists?, #reset, #size, #storage

Methods included from Registerable

included

Methods included from Common

#defined_value?

Constructor Details

This class inherits a constructor from Vedeu::Repository

Class Method Details

.groupsVedeu::Groups Also known as: repository

Returns:



9
10
11
# File 'lib/vedeu/repositories/repositories/groups.rb', line 9

def groups
  @groups ||= reset!
end

.reset!Vedeu::Groups

Remove all stored models from the repository.

Returns:



17
18
19
# File 'lib/vedeu/repositories/repositories/groups.rb', line 17

def reset!
  @groups = Vedeu::Groups.register(Vedeu::Group)
end

Instance Method Details

#by_name(name) ⇒ Vedeu::Group

Parameters:

  • name (String)

    The name of the stored group.

Returns:



25
26
27
28
29
30
31
32
33
# File 'lib/vedeu/repositories/repositories/groups.rb', line 25

def by_name(name)
  if registered?(name)
    find(name)

  else
    Vedeu::Group.new(name: name).store

  end
end