Module: Neo::DCI::Data

Defined in:
lib/neo/dci/data.rb

Instance Method Summary collapse

Instance Method Details

#role_as(role, *params) ⇒ Object

Enhances an object with the Role role.



5
6
7
8
9
10
11
12
13
# File 'lib/neo/dci/data.rb', line 5

def role_as(role, *params)
  if role.assignable_to?(self, *params)
    extend role
    role.role_assigned(self, *params)
    self
  else
    raise Neo::DCI::Role::NotAssignable.new role, self, params
  end
end