constructor
 @param [Object] the role subject
550212
def rolegroups_to_embed *rolegroups
      rolegroups.flatten.inject([]) do |res, role| 
        res << create_role(role)
        res
      end
    end
1130544
def initialize_rails(name, log_subscriber, controller_runtime)
      log_subscriber.attach_to name.to_sym
      ActiveSupport.on_load(:action_controller) do
        include controller_runtime
      end
    end
283854
public function _construct()
    {
        parent::_construct();
        $this->_init(\Dotdigitalgroup\Email\Model\ResourceModel\Review::class);
    }
205454
function doConstitutors(constructor) {

		var waiting,
		    tasks,
		    i;

		if (has_constituted.get(constructor)) {
			return;
		}

		has_constituted.set(constructor, true);

		tasks = constructor.constitutors;

		if (tasks) {
			for (i = 0; i < tasks.length; i++) {
				doConstructorTask(constructor, tasks[i]);
			}
		}

		waiting = waiting_children.get(constructor);

		if (!waiting || !waiting.length) {
			return;
		}

		for (i = 0; i < waiting.length; i++) {
			doConstitutors(waiting[i]);
		}
	}
381036
def roles_for (user)
      user ||= Authorization.current_user
      raise AuthorizationUsageError, "User object doesn't respond to roles (#{user.inspect})" \
        if !user.respond_to?(:role_symbols) and !user.respond_to?(:roles)

      Rails.logger.info("The use of user.roles is deprecated.  Please add a method " +
          "role_symbols to your User model.") if defined?(Rails) and Rails.respond_to?(:logger) and !user.respond_to?(:role_symbols)

      roles = user.respond_to?(:role_symbols) ? user.role_symbols : user.roles

      raise AuthorizationUsageError, "User.#{user.respond_to?(:role_symbols) ? 'role_symbols' : 'roles'} " +
        "doesn't return an Array of Symbols (#{roles.inspect})" \
            if !roles.is_a?(Array) or (!roles.empty? and !roles[0].is_a?(Symbol))

      (roles.empty? ? [Authorization.default_role] : roles)
    end
1166219
def update_roles(role_ids)
      @roles = []
      role_ids.each do |id|
        # It is posible for members to have roles that do not exist
        # on the server any longer. See https://github.com/meew0/discordrb/issues/371
        role = @server.role(id)
        @roles << role if role
      end
    end
1054752
def set_roles(role, reason = nil)
      role_ids = role_id_array(role)
      API::Server.update_member(@bot.token, @server.id, @user.id, roles: role_ids, reason: reason)
    end
1064168
def roles_to_embed *roles
      roles.flatten.inject([]) do |res, role| 
        res << create_role(role)
        res
      end
    end
618912
def changeUserRole( dbid, userid, roleid, newroleid )
      @dbid, @userid, @roleid, @newroleid = dbid, userid, roleid, newroleid
      
      xmlRequestData = toXML( :userid, @userid )
      xmlRequestData << toXML( :roleid, @roleid )
      xmlRequestData << toXML( :newroleid, @newroleid )
      
      sendRequest( :changeUserRole, xmlRequestData )

      return self if @chainAPIcalls
      @requestSucceeded
    end
919599
private RaftRole createRole(RaftServer.Role role) {
    switch (role) {
      case INACTIVE:
        return new InactiveRole(this);
      case PASSIVE:
        return new PassiveRole(this);
      case PROMOTABLE:
        return new PromotableRole(this);
      case FOLLOWER:
        return new FollowerRole(this);
      case CANDIDATE:
        return new CandidateRole(this);
      case LEADER:
        return new LeaderRole(this);
      default:
        throw new AssertionError();
    }
  }
719502
@POST
    @Path("{group}/{id}")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response createRole(@PathParam("group") String group, @PathParam("id") String id, EmoRole role,
                                      final @Authenticated Subject subject) {
        checkArgument(role.getId().equals(new EmoRoleKey(group, id)),
                "Body contains conflicting role identifier");
        return createRoleFromUpdateRequest(group, id,
                new CreateEmoRoleRequest()
                        .setName(role.getName())
                        .setDescription(role.getDescription())
                        .setPermissions(role.getPermissions()),
                subject);
    }
920135
@SuppressWarnings("unchecked")
    @Override
    public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
        this.callbackHandler = callbackHandler;
        this.subject = subject;
        this.sharedState = (Map<String, Object>) sharedState;
        this.options = options;
    }
260714
def _handle_start_member(self, attrs):
        

        params = {
            # ToDo: Parse attributes
            'attributes': {},
            'ref': None,
            'result': self._result,
            'role': None
        }
        if attrs.get('ref', None):
            params['ref'] = int(attrs['ref'])
        if attrs.get('role', None):
            params['role'] = attrs['role']

        cls_map = {
            "area": RelationArea,
            "node": RelationNode,
            "relation": RelationRelation,
            "way": RelationWay
        }
        cls = cls_map.get(attrs["type"])
        if cls is None:
            raise ValueError("Undefined type for member: '%s'" % attrs['type'])

        self.cur_relation_member = cls(**params)
        self._curr['members'].append(self.cur_relation_member)
775218
@Override
    public Relation assign(Role role, Thing player) {
        reify().addRolePlayer(role, player);
        return this;
    }
1307265
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof Subject)){
    return new Subject(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(Subject.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
853287
function getRole(user) {
      user = user || getCurrentUser();
      return _.find(userRoles, {role: user.role});
    }
784305
private void setSubjectPrincipals() {
        if (null != userPrincipal) {
            this.subject.getPrincipals().add(userPrincipal);
        }
        if (null != rolePrincipals) {
            for (Principal rolePrincipal : rolePrincipals) {
                this.subject.getPrincipals().add(rolePrincipal);
            }
        }
    }