Class: Eaco::Cucumber::ActiveRecord::User::Designators::Position

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

Overview

A Designator based on a position an User occupies in an organigram. It resolves Actors by id looking them up from the user_id field.

The Position ID is available as the Designator#value.

The String representation for an example Position 42 is “position:42”.

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

#describeString

This Designator description.

Returns:


24
25
26
# File 'lib/eaco/cucumber/active_record/user/designators/position.rb', line 24

def describe(*)
  "#{position.name} in #{position.department.name}"
end

#positionActiveRecord::Position (private)

Looks up this position by ID, and memoizes it in an instance variable.

Returns:


44
45
46
# File 'lib/eaco/cucumber/active_record/user/designators/position.rb', line 44

def position
  @_position ||= ActiveRecord::Position.find(self.value)
end

#resolveArray

Users matching this designator.

Returns:

  • (Array)

    the user currently occupying this Position.


33
34
35
# File 'lib/eaco/cucumber/active_record/user/designators/position.rb', line 33

def resolve
  [position.user]
end