Class: Eaco::Cucumber::ActiveRecord::User::Designators::Department

Inherits:
Designator
  • Object
show all
Defined in:
lib/eaco/cucumber/active_record/user/designators/department.rb

Overview

A Designator based on a the Department an User occupies a Position in. It resolves Actors by id looking them up through the Position model.

As Departments have unique names, their name instead of their ID is used in this example.

The Department name is available as the Designator#value.

The String representation for an example ICT Department is “department:ICT”.

Instance Attribute Summary

Attributes inherited from Designator

#instance, #value

Instance Method Summary collapse

Methods inherited from Designator

#as_json, configure!, designator_name, harvest, id, #initialize, #inspect, label, #label, make, parse, resolve, search, #type

Constructor Details

This class inherits a constructor from Eaco::Designator

Instance Method Details

#departmentActiveRecord::Department (private)

Looks up this Department by name, and memoizes it in an instance variable.

Returns:



48
49
50
51
# File 'lib/eaco/cucumber/active_record/user/designators/department.rb', line 48

def department
  @_department ||= ActiveRecord::Department.
    where(name: self.value).first!
end

#describeString

This Designator description.

Returns:



27
28
29
# File 'lib/eaco/cucumber/active_record/user/designators/department.rb', line 27

def describe(*)
  department.name
end

#resolveArray

Users matching this designator.

Returns:

  • (Array)

    all users currently occupying a position in this Department



37
38
39
# File 'lib/eaco/cucumber/active_record/user/designators/department.rb', line 37

def resolve
  department.users
end