Module: Bridgetown::Prioritizable::ClassMethods
- Defined in:
- bridgetown-core/lib/bridgetown-core/concerns/prioritizable.rb
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Spaceship is priority [higher -> lower].
-
#priorities ⇒ Object
Return either this class’ priorities or the superclass which has them (if any).
-
#priorities=(val) ⇒ 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 'bridgetown-core/lib/bridgetown-core/concerns/prioritizable.rb', line 26 def <=>(other) priorities[other.priority] <=> priorities[priority] end |
#priorities ⇒ Object
Return either this class’ priorities or the superclass which has them (if any)
|
# File 'bridgetown-core/lib/bridgetown-core/concerns/prioritizable.rb', line 6
|
#priorities=(val) ⇒ Object
37 38 39 |
# File 'bridgetown-core/lib/bridgetown-core/concerns/prioritizable.rb', line 37 def priorities=(val) @priorities = val end |
#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 'bridgetown-core/lib/bridgetown-core/concerns/prioritizable.rb', line 16 def priority(priority = nil) @priority ||= nil @priority = priority if priority && priorities.key?(priority) @priority || :normal end |