These methods are included in all User instances
176093
def add_role name
      if allowed_role? name
        return if has_role? name
        role = Role.find_by(name: name.to_s)
        roles << role
      end
    end
457987
def synchronize_all_methods
      methods = self.class.instance_methods - self.class.superclass.instance_methods

      methods.each do |method_name|
        old_method = :"old_#{method_name}"
        new_method = :"synchronized_#{method_name}"

        self.class.__send__(:alias_method, old_method, method_name)

        self.class.send(:define_method, new_method) do |*args|
          @lock.synchronize { __send__(old_method, *args) }
        end

        self.class.__send__(:alias_method, method_name, new_method)
      end
    end
478595
function users() {

	var seminarjs = this;

	var exports = {};

	exports.list = [];

	/**
	 * Add a user
	 * @param {string} name       User name
	 * @param {Object} attributes List of attributes to be added to the user
	 */
	exports.add = function (name, attributes) {
		if (exports.find(name)) {
			return false;
		} else {
			exports.list.push(new User(name, attributes));
		}
	};

	/**
	 * Finds users
	 * @param  {string} name User name
	 * @return {int}	Integer >-1 if the user is found, or -1 if not.
	 */
	exports.find = function (name) {
		var total = exports.list.length;

		for (var i = 0; i < total; i++) {
			if (exports.list[i].name == name) {
				return i;
			}
		}

		return -1;
	};

	/**
	 * Removes a user from the list
	 * @param  {string} name User name
	 */
	exports.remove = function (name) {
		var index = exports.find(name);

		exports.list.splice(index, 1);
	};

	/**
	 * Set a property for a user
	 * @param {string} name  Username
	 * @param {String} param Parameter name
	 * @param {String} value Parameter value
	 */
	exports.set = function (name, param, value) {
		var index = exports.find(name);

		exports.list[index][param] = value;
	};

	/**
	 * Get a parameter
	 * @param  {string} name  User name
	 * @param  {String} param Parameter name
	 * @return {String}       Parameter value
	 */
	exports.get = function (name, param) {
		var index = exports.find(name);

		return exports.list[index][param];
	};

	/**
	 * User constructor
	 * @param {string} name       User name
	 * @param {object} attributes User properties
	 */
	function User(name, attributes) {
		var ret = {
			name: user
		};

		return extend(ret, attributes);
	}

	return exports;
}
340008
function User(data){
    var self = this;
    Object.keys(data).map(function(k){
      self[k] = data[k];
    });
  }
426234
def singleton_events(all = true)
      if all
        contributors  = self.singleton_class.included_modules
        contributors -= self.class.included_modules
        contributors.push self.singleton_class
        Unobservable.collect_instance_events_defined_by(contributors)
      else
        Unobservable.collect_instance_events_defined_by([self.singleton_class])
      end
    end
420452
public void addApplicationInstances(Collection<ApplicationInstance> applicationInstances)
    {
        for(ApplicationInstance applicationInstance : applicationInstances)
        {
            // Add the instance to any application hosts it is associated with
            long applicationHostId = applicationInstance.getLinks().getApplicationHost();
            ApplicationHost applicationHost = applicationHosts.get(applicationHostId);
            if(applicationHost != null)
                applicationInstances(applicationHostId).add(applicationInstance);
            else
                logger.severe(String.format("Unable to find application host for application instance '%s': %d", applicationInstance.getName(), applicationHostId));
        }
    }
1154712
function UserProviderMethods(models) {
      this.models = models;
      this.getUserFromProvider = bind(this.getUserFromProvider, this);
      Hoek.assert(this.models, i18n.assertModelsRequired);
    }
997701
def add_method_hooks
      eigen_class = @target.singleton_class

      if @options[:class_methods]
        return unless @target.is_a?(Module)

        orig_singleton_method_added = @target.method(:singleton_method_added)

        eigen_class.send :define_method, :singleton_method_added do |method|
          aspector_singleton_method_added(method)
          orig_singleton_method_added.call(method)
        end
      else
        if @target.is_a? Module
          orig_method_added = @target.method(:method_added)
        else
          orig_method_added = eigen_class.method(:method_added)
        end

        eigen_class.send :define_method, :method_added do |method|
          aspector_instance_method_added(method)
          orig_method_added.call(method)
        end
      end
    end
1227607
public void executeMethods(final List<Method> methods) throws Exception {

        for (final Method method : methods) {

            // TODO - curious about the findSuitableInstancesOf ? won't
            // method.getDeclaringClass be ok??

            for (final Object object : findSuitableInstancesOf(method.getDeclaringClass())) {

                method.invoke(object);

            }
        }
    }
783988
function() {
                    var el = this.element[0],
                        bindings = this._bindings;
                    if (bindings) {
                        each(bindings.user || [], function(value) {
                            value(el);
                        });
                        each(bindings.control || {}, function(value) {
                            value(el);
                        });
                    }
                    // Adds bindings.
                    this._bindings = {
                        user: [],
                        control: {}
                    };
                }
855851
def add_discerner_user_method
      current_user_helper = options["current-user-helper"].presence ||
                            ask("What is the current_user helper called in your app? [current_user]").presence ||
                            'current_user if defined?(current_user)'
      puts "Defining discerner_user method inside ApplicationController..."

      discerner_user_method = %Q{
  def discerner_user
    #{current_user_helper}
  end
  helper_method :discerner_user
}
      inject_into_file("#{Rails.root}/app/controllers/application_controller.rb",
                       discerner_user_method,
                       after: "ActionController::Base\n", force: false)
    end
1247683
protected void initUserObject() {

        Object o = null;
        try {
            if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
                // edit an existing user, get the user object from db
                m_user = getCms().readUser(new CmsUUID(getParamUserid()));
                m_pwdInfo = new CmsPasswordInfo();
                CmsUserSettings settings = new CmsUserSettings(m_user);
                m_language = settings.getLocale().toString();
                m_site = CmsStringUtil.joinPaths(settings.getStartSite(), "/");
                m_startProject = settings.getStartProject();
                m_startFolder = settings.getStartFolder();
                m_startView = settings.getStartView();
                return;
            } else {
                // this is not the initial call, get the user object from session
                o = getDialogObject();
                Map<?, ?> dialogObject = (Map<?, ?>)o;
                m_user = (CmsUser)dialogObject.get(USER_OBJECT);
                m_pwdInfo = (CmsPasswordInfo)dialogObject.get(PWD_OBJECT);
                CmsUserSettings settings = new CmsUserSettings(m_user);
                m_language = settings.getLocale().toString();
                m_site = CmsStringUtil.joinPaths(settings.getStartSite(), "/");
                m_startProject = settings.getStartProject();
                m_startFolder = settings.getStartFolder();
                m_startView = settings.getStartView();
                return;
            }
        } catch (Exception e) {
            // noop
        }
        // create a new user object
        m_user = new CmsUser();
        m_pwdInfo = new CmsPasswordInfo();
        m_group = "";
        try {
            m_group = getCms().readGroup(getParamOufqn() + OpenCms.getDefaultUsers().getGroupUsers()).getName();
        } catch (CmsException e) {
            // ignore
        }
        m_language = CmsLocaleManager.getDefaultLocale().toString();
        m_site = CmsStringUtil.joinPaths(OpenCms.getSiteManager().getDefaultSite().getSiteRoot(), "/");
        m_startProject = OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartProject();
        m_startFolder = OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartFolder();
        m_startView = OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartView();
    }
312791
def _include_public_methods(self, connection):
        
        for attr in dir(connection):
            value = getattr(connection, attr)
            if attr.startswith('_') or not callable(value):
                continue
            self.__dict__[attr] = self._wrap_public_method(attr)
936862
public void addInstance(InstanceInfo i) {
        instancesMap.put(i.getId(), i);
        synchronized (instances) {
            instances.remove(i);
            instances.add(i);
            isDirty = true;
        }
    }
569816
public static <R, T> R invokeMethod(T instance, Method method, Object... arguments) {
        try {
            return (R) method.invoke(instance, arguments);
        } catch (IllegalAccessException e) {
            throw new InvocationException("Illegal access invoking method [" + method + "]: " + e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new InvocationException("Exception occurred invoking method [" + method + "]: " + e.getMessage(), e);
        }
    }
962905
public void addInstance(Object instance)
            throws Exception
    {
        if (isDestroyed()) {
            throw new IllegalStateException("System already stopped");
        }
        else {
            startInstance(instance);
            if (methodsMap.get(instance.getClass()).hasFor(PreDestroy.class)) {
                managedInstances.add(instance);
            }
        }
    }
473557
def method_missing(m, *args)
      # the method href would have been defined while initializing the object
      client.send(:do_post, [ href, m.to_s ].join('/'), *args)
    end