Class: UltraSettings::RackApp

Inherits:
Object
  • Object
show all
Defined in:
lib/ultra_settings/rack_app.rb

Overview

Rack application for displaying the current settings in an HTML page. No setting values are displayed, but you should still add some sort of authentication if you want to use this in production.

Instance Method Summary collapse

Constructor Details

#initialize(color_scheme: nil) ⇒ RackApp

Initialize a new Rack application for displaying settings.

Parameters:

  • color_scheme (Symbol, nil) (defaults to: nil)

    The color scheme to use in the UI (:light, :dark, or :system).



11
12
13
14
# File 'lib/ultra_settings/rack_app.rb', line 11

def initialize(color_scheme: nil)
  @webview = nil
  @color_scheme = color_scheme
end

Instance Method Details

#call(env) ⇒ Array

Handle Rack requests and return the settings HTML page.

Parameters:

  • env (Hash)

    The Rack environment.

Returns:

  • (Array)

    A Rack response array [status, headers, body].



20
21
22
# File 'lib/ultra_settings/rack_app.rb', line 20

def call(env)
  [200, {"content-type" => "text/html; charset=utf8"}, [webview.render_settings]]
end