module CHECKING::YOU::WeightedAction

Several of our utility classes are like built-in-Ruby-type-plus-weight-for-comparison. Importing this Module enables that behavior.

Constants

DEFAULT_WEIGHT

In `shared-mime-info`, “The default priority value is 50, and the maximum is 100.”

Public Class Methods

new(*args, weight: nil, **kwargs) click to toggle source
Calls superclass method
# File lib/checking-you-out/party_starter/weighted_action.rb, line 9
def initialize(*args, weight: nil, **kwargs)
  # Don't allocate an IVar if we're just going to use the default value.
  instance_variable_set(:@weight, weight) unless weight.nil? or weight == DEFAULT_WEIGHT
  super(*args, **kwargs)
end

Public Instance Methods

<=>(otra) click to toggle source
# File lib/checking-you-out/party_starter/weighted_action.rb, line 23
def <=>(otra); self.weight <=> otra.weight; end
clear() click to toggle source
Calls superclass method
# File lib/checking-you-out/party_starter/weighted_action.rb, line 16
def clear;           remove_instance_variable(:@weight) if instance_variable_defined?(:@weight); super;      end
inspect() click to toggle source
# File lib/checking-you-out/party_starter/weighted_action.rb, line 17
def inspect;         "#<#{self.class.name} #{weight} #{self.to_s}>";                                         end
weight() click to toggle source
# File lib/checking-you-out/party_starter/weighted_action.rb, line 14
def weight;          @weight || DEFAULT_WEIGHT;                                                              end
weight=(weight) click to toggle source
# File lib/checking-you-out/party_starter/weighted_action.rb, line 15
def weight=(weight); instance_variable_set(:@weight, weight) unless weight.nil? or weight == DEFAULT_WEIGHT; end