Class: YapShellAddonRightPrompt::Addon

Inherits:
Yap::Addon::Base
  • Object
show all
Defined in:
lib/yap-shell-addon-right-prompt.rb

Instance Method Summary collapse

Instance Method Details

#initialize_world(world) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/yap-shell-addon-right-prompt.rb', line 8

def initialize_world(world)
  @world = world

  @world.subscribe(:refresh_right_prompt) do |event|
    @world.right_prompt_text = Time.now.strftime("%H:%M:%S")
  end

  @world.events.recur(
    name: "refresh_right_prompt", source: self, interval_in_ms: 1_000
  )
end