Use for sort_if_enabled which requires the attribute name
494193
def field_attribute(attr)
      return 'id'           if attr == :_id
      # default, simply return name
      return attr           unless attr.is_a? Hash
      # else, Hash
      return attr[:object]  if attr.has_key? :object
      return attr[:array]   if attr.has_key? :array
      return attr[:value]   if attr.has_key? :value
      return attr[:link]    if attr.has_key? :link

      attr.keys[0]
    end
315417
def _sortAttributeValue(self, offset):
        
        if self._currentResults:
            pageStart = (self._currentResults[offset][
                self.currentSortColumn.attributeID],
                         self._currentResults[offset][
                    '__item__'].storeID)
        else:
            pageStart = None
        return pageStart
631217
def method_missing(attr_name)
      member_sym = attr_name.id2name.to_sym
      self[member_sym]
    rescue ArgumentError # `member_sym` field doesn't exist.
      raise(NoMethodError.new("undefined method '#{attr_name}' for #{self}"))
    end
391984
def sorted(self, attrname, reverse=False):
        
        attrs = []
        for i, pseudo in self:
            try:
                a = getattr(pseudo, attrname)
            except AttributeError:
                a = np.inf
            attrs.append((i, a))

        # Sort attrs, and build new table with sorted pseudos.
        return self.__class__([self[a[0]] for a in sorted(attrs, key=lambda t: t[1], reverse=reverse)])
930344
function(attr) {
			// Create the sort function
			var sortFn;

			// CASE: Simple ascending sort
			if (attr == null) {
				sortFn = function(a, b) { return a - b; };
			}
			// CASE: Simple descending sort
			else if (attr === true) {
				sortFn = function(a, b) { return b - a; };
			}
			// CASE: Sort by an attribute
			else if (typeof attr === 'string') {
				sortFn = function(a, b) { return a[attr] - b[attr]; };
			}
			// CASE: Sort by a function
			else {
				sortFn = attr;
			}

			this.arr = this.arr.sort(sortFn);

			return this;
		}
334973
def attribute_present?(name)
      attribute = read_raw_attribute(name)
      !attribute.blank? || attribute == false
    rescue ActiveModel::MissingAttributeError
      false
    end
986137
private String getOrderByColumn(String[] orderByColumns, Attribute column)
    {

        if (orderByColumns != null)
        {
            for (String orderColumn : orderByColumns)
            {
                String[] orderValue = orderColumn.split("\\s");
                String orderColumnName = orderValue[0].substring(orderValue[0].lastIndexOf('.') + 1);
                String orderColumnValue = orderValue[1];

                if (orderColumnName.equals(((AbstractAttribute) column).getName())
                        || orderColumnName.equals(((AbstractAttribute) column).getJPAColumnName()))
                {
                    return orderColumnValue;
                }
            }
        }
        return null;

    }
972351
function _getIndexesInArray(attrs, attr) {
    var res = [];

    for (var i = 0; i < attrs.length; i++) {
        if (attrs[i].name === attr) res.push(i);
    }

    return res;
}
875794
def matching_attributes?(attribute, filter)
      attribute.to_s.downcase == filter.to_s.delete('_').downcase
    end
114377
function sortCssClasses(attrs) {
    /**
     * Sorts the given CSS class attribute
     * @param {String} cssClasses
     * @returns {String}
     */
    function _sortCssClassesValues(cssClasses) {
        var classList = (cssClasses || '').split(' ');

        return _(classList)
            .filter()
            .uniq()
            .sort()
            .join(' ');
    }

    var classIndexes = _getIndexesInArray(attrs, 'class');

    _.forEach(classIndexes, function (index) {
        attrs[index].value = _sortCssClassesValues(attrs[index].value);
    });

    return attrs;
}
11713
def sort=(sort)
      validator = EnumAttributeValidator.new('String', ["COUNT", "INDEX"])
      unless validator.valid?(sort)
        fail ArgumentError, "invalid value for 'sort', must be one of #{validator.allowable_values}."
      end
      @sort = sort
    end
1172428
def has_attribute(module_name, attribute_name):
    """"""
    init_file = '%s/__init__.py' % module_name
    return any(
        [attribute_name in init_line for init_line in open(init_file).readlines()]
    )
164374
def rename_if(attributes, conditions = {})
      if block_given?
        set(attributes) if yield self
      else
        set(attributes) if conditions.all? do |key, value|
          respond_to?(key) && send(key) == value
        end
      end

      self
    end
382662
def set_sort_cb(self, w, index):
        """"""
        name = self.sort_options[index]
        self.t_.set(sort_order=name)
1143614
def attribute_name(self, attribute_name):
        

        if attribute_name is None:
            raise ValueError("Invalid value for `attribute_name`, must not be `None`")
        if len(attribute_name) < 1:
            raise ValueError("Invalid value for `attribute_name`, length must be greater than or equal to `1`")

        self._attribute_name = attribute_name
85385
def sort_by(self, attr_name, reverse=False):
        
        try:
            d = dict()
            for abspath, winfile in self.files.items():
                d[abspath] = getattr(winfile, attr_name)
            self.order = [item[0] for item in sorted(
                list(d.items()), key=lambda t: t[1], reverse = reverse)]
        except AttributeError:
            raise ValueError("valid sortable attributes are: "
                             "abspath, dirname, basename, fname, ext, "
                             "size_on_disk, atime, ctime, mtime;")
1071323
def visit_attribute(self, node):
        """"""
        return "%s.%s" % (self._precedence_parens(node, node.expr), node.attrname)