Sha256: cbdc610496661a540654838b1859ab7d7a5783f36e3c3493cb05540082619424
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
module Trestle class Navigation class Group attr_reader :name, :options def initialize(name, options={}) @name = name @options = options end def ==(other) other.is_a?(self.class) && name == other.name end alias eql? == def hash name.hash end def <=>(other) case other when Group priority <=> other.priority when NullGroup 1 end end def priority case options[:priority] when :first -Float::INFINITY when :last Float::INFINITY else options[:priority] || 0 end end def label I18n.t("admin.navigation.groups.#{name}", default: name.to_s.titlecase) end end class NullGroup def present? false end def ==(other) other.is_a?(NullGroup) end def eql?(other) other.is_a?(NullGroup) end def hash NullGroup.hash end def <=>(other) -1 end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.8.4 | lib/trestle/navigation/group.rb |
trestle-0.8.3 | lib/trestle/navigation/group.rb |
trestle-0.8.2 | lib/trestle/navigation/group.rb |
trestle-0.8.0 | lib/trestle/navigation/group.rb |