lib/lookbook/entity.rb in lookbook-3.0.0.alpha.1 vs lib/lookbook/entity.rb in lookbook-3.0.0.alpha.2

- old
+ new

@@ -1,7 +1,9 @@ module Lookbook class Entity + DEFAULT_PRIORITY = 1 + send(:include, Lookbook::Engine.routes.url_helpers) # YARD parsing workaround: https://github.com/lsegal/yard/issues/546 def id raise Lookbook::Error, "Entity subclasses must define an #id method" end @@ -27,20 +29,20 @@ def hidden? false end def priority - default_priority || 0 + default_priority || DEFAULT_PRIORITY end attr_reader :default_priority def type @type ||= self.class.name.demodulize.underscore.delete_suffix("_entity").to_sym end def <=>(other) - [priority || Float::INFINITY, label] <=> [other.priority || Float::INFINITY, other.label] + [priority || DEFAULT_PRIORITY, label.downcase] <=> [other.priority || DEFAULT_PRIORITY, other.label.downcase] end def parent_lookup_path = nil def url_path = nil