class EverydayMenu::DynamicTitle

Attributes

title[RW]

Public Class Methods

new(getter, item_parent, item, title) click to toggle source
# File lib/everyday-menu/menu_item.rb, line 4
def initialize(getter, item_parent, item, title)
  @getter = getter
  @item_parent = item_parent
  @item = item
  @title = title
  @item.bind('title', toObject: self, withKeyPath: 'title', options: { 'NSContinuouslyUpdatesValue' => true })
  @item.bind(NSEnabledBinding, toObject: @item_parent.commands, withKeyPath: 'canExecute', options: nil)
end

Public Instance Methods

update() click to toggle source
# File lib/everyday-menu/menu_item.rb, line 12
def update
  self.performSelectorOnMainThread('title=:', withObject: @getter.call, waitUntilDone: false)
end