Module: Bridgetown::Prioritizable::ClassMethods
- Defined in:
- lib/bridgetown-core/concerns/prioritizable.rb
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Spaceship is priority [higher -> lower].
- #priorities ⇒ Hash<Symbol, Object>
-
#priority(priority = nil) ⇒ Symbol
Get or set the priority of this class.
Instance Method Details
#<=>(other) ⇒ Integer
Spaceship is priority [higher -> lower]
26 27 28 |
# File 'lib/bridgetown-core/concerns/prioritizable.rb', line 26 def <=>(other) priorities[other.priority] <=> priorities[priority] end |
#priorities ⇒ Hash<Symbol, Object>
|
# File 'lib/bridgetown-core/concerns/prioritizable.rb', line 6
|
#priority(priority = nil) ⇒ Symbol
Get or set the priority of this class. When called without an argument it returns the priority. When an argument is given, it will set the priority.
16 17 18 19 20 |
# File 'lib/bridgetown-core/concerns/prioritizable.rb', line 16 def priority(priority = nil) @priority ||= nil @priority = priority if priority && priorities.key?(priority) @priority || :normal end |