class Staticpress::Plugins::Menu::MenuItem
Attributes
position[R]
sub_items[R]
text[R]
url_path[R]
Public Class Methods
new(position, text, url_path, sub_items = [])
click to toggle source
# File lib/staticpress/plugins/menu.rb, line 62 def initialize(position, text, url_path, sub_items = []) @position = position.to_i @text = text @url_path = url_path @sub_items = sub_items end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/staticpress/plugins/menu.rb, line 69 def <=>(other) reply = case when (position < 0) && (other.position < 0) then other.position.abs <=> position.abs when (position < 0) || (other.position < 0) then other.position <=> position else position <=> other.position end reply.zero? ? (text <=> other.text) : reply end