Class: TRMNLPreview::App
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- TRMNLPreview::App
- Defined in:
- lib/trmnl_preview/app.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(*args) ⇒ App
Returns a new instance of App.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/trmnl_preview/app.rb', line 14 def initialize(*args) super begin @context = Context.new(settings.user_dir) rescue StandardError => e puts e. exit 1 end @context.poll_data if @context.strategy == 'polling' @live_render_clients = VIEWS.each_with_object({}) { |view, hash| hash[view] = [] } @context.on_view_change do |view| @live_render_clients[view].each do |ws| ws.send(@context.render_template(view)) end end end |