Sha256: 8a939d52ca02a3d880d73e0598231bc4795625cce3d9b5cbcdd4e2dbf1ff5540
Contents?: true
Size: 1.18 KB
Versions: 6
Compression:
Stored size: 1.18 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 def id name.to_s.parameterize 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 id nil end def <=>(other) -1 end end end end
Version data entries
6 entries across 6 versions & 1 rubygems