Class: Eaco::Cucumber::ActiveRecord::User::Designators::Department
- Inherits:
-
Designator
- Object
- String
- Designator
- Eaco::Cucumber::ActiveRecord::User::Designators::Department
- 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 Method Summary collapse
-
#department ⇒ ActiveRecord::Department
private
Looks up this Department by name, and memoizes it in an instance variable.
-
#describe ⇒ String
This Designator description.
-
#resolve ⇒ Array
Users matching this designator.
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
#department ⇒ ActiveRecord::Department (private)
Looks up this Department by name, and memoizes it in an instance variable.
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 |
#describe ⇒ String
This Designator description.
27 28 29 |
# File 'lib/eaco/cucumber/active_record/user/designators/department.rb', line 27 def describe(*) department.name end |
#resolve ⇒ Array
Users matching this designator.
37 38 39 |
# File 'lib/eaco/cucumber/active_record/user/designators/department.rb', line 37 def resolve department.users end |