class Eaco::Cucumber::ActiveRecord::User::Designators::Position

A {Designator} based on a position an {User} occupies in an organigram. It resolves {Actor}s 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”+.

Public Instance Methods

describe(*) click to toggle source

This {Designator} description.

@return [String] the {Position} name, such as “Manager” or

or "Systems Analyst" or "Consultant".
# File lib/eaco/cucumber/active_record/user/designators/position.rb, line 24
def describe(*)
  "#{position.name} in #{position.department.name}"
end
resolve() click to toggle source

{User}s matching this designator.

@return [Array] the user currently occupying this Position.

# File lib/eaco/cucumber/active_record/user/designators/position.rb, line 33
def resolve
  [position.user]
end

Private Instance Methods

position() click to toggle source

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

@return [ActiveRecord::Position] the referenced Position.

# File lib/eaco/cucumber/active_record/user/designators/position.rb, line 44
def position
  @_position ||= ActiveRecord::Position.find(self.value)
end