Class: UltraSettings::ConfigurationView
- Inherits:
-
Object
- Object
- UltraSettings::ConfigurationView
- Includes:
- RenderHelper
- Defined in:
- lib/ultra_settings/configuration_view.rb
Overview
This class can render information about a configuration in a clean card-based layout. It is used by the bundled web UI, but you can use it to embed the configuration information in your own web pages.
The output will be HTML with a card-based layout for better readability. The ‘table_class` option is still supported for backward compatibility but is no longer used in the new card layout.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ ConfigurationView
constructor
Initialize the configuration view with a configuration instance.
-
#render(table_class: "") ⇒ String
Render the HTML for the configuration view.
-
#to_s ⇒ String
Convert the view to a string by rendering it.
Methods included from RenderHelper
Constructor Details
#initialize(configuration) ⇒ ConfigurationView
Initialize the configuration view with a configuration instance.
19 20 21 |
# File 'lib/ultra_settings/configuration_view.rb', line 19 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#render(table_class: "") ⇒ String
Render the HTML for the configuration view.
27 28 29 30 31 32 |
# File 'lib/ultra_settings/configuration_view.rb', line 27 def render(table_class: "") configuration = @configuration html = ViewHelper.erb_template("configuration.html.erb").result(binding) html = html.html_safe if html.respond_to?(:html_safe) html end |
#to_s ⇒ String
Convert the view to a string by rendering it.
37 38 39 |
# File 'lib/ultra_settings/configuration_view.rb', line 37 def to_s render end |