Module: Neo
- Defined in:
- lib/neo/dci/role.rb,
lib/neo/dci.rb,
lib/neo/dci/data.rb,
lib/neo/dci/context.rb,
lib/neo/dci/version.rb,
lib/neo/dci/task_loader.rb,
lib/neo/dci/context_result.rb
Overview
A Role gives an object (e.g. an User) specific behaviour (or methods).
Example
module TeamMember
extend Neo::DCI::Role
def self.assignable_to?(user, team)
team.member?(user)
end
def leave_team!(team)
# ...
end
end
class User
include Neo::DCI::Data
end
team_member = team.members.first
team_member.role_as TeamMember
team_member.leave_team!(team)
non_member = User.find(1)
non_member.role_as TeamMember # => raises Role::NotAssignable
Defined Under Namespace
Modules: DCI