Class: ViewRouterActor

Inherits:
Object show all
Includes:
BasicActor
Defined in:
lib/view_router_actor.rb

Instance Method Summary collapse

Methods included from BasicActor

included

Constructor Details

#initializeViewRouterActor

Returns a new instance of ViewRouterActor.



4
5
6
7
8
9
10
11
# File 'lib/view_router_actor.rb', line 4

def initialize
  subscribe "welcome_user", :welcome_user
  subscribe "display_help", :display_help
  subscribe "display_working_set", :display_working_set
  subscribe "window_resized", :render_current_view
  subscribe "render_view", :render_view
  welcome_user
end

Instance Method Details

#display_help(_) ⇒ Object



18
19
20
21
# File 'lib/view_router_actor.rb', line 18

def display_help(_)
  debug_message "displaying help!"
  render_view nil, View::Help
end

#display_working_set(_) ⇒ Object



23
24
25
26
# File 'lib/view_router_actor.rb', line 23

def display_working_set(_)
  debug_message "displaying working_set!"
  publish "render_working_set"
end

#render_current_view(_ = nil) ⇒ Object



33
34
35
36
# File 'lib/view_router_actor.rb', line 33

def render_current_view(_=nil)
  debug_message "rendering view: #{@current_view.inspect}"
  @current_view&.render
end

#render_view(_, view) ⇒ Object



28
29
30
31
# File 'lib/view_router_actor.rb', line 28

def render_view(_, view)
  @current_view = view
  render_current_view
end

#welcome_user(_ = nil) ⇒ Object



13
14
15
16
# File 'lib/view_router_actor.rb', line 13

def welcome_user(_=nil)
  debug_message "displaying welcome_user!"
  render_view nil, View::WelcomeUser
end