Class: Glib::JsonUi::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/glib/json_ui/config.rb

Overview

Global JSON UI settings.

name_separator controls the character that joins the namespace and the component/action name in the generated JSON, e.g. panels/responsive (default) vs panels_responsive.

The default stays / for backwards compatibility; _ becomes the default in the next major version. Apps opt in early via an initializer:

# config/initializers/glib.rb
Glib::JsonUi::Config.name_separator = '_'

Frontends built on glib-web-npm accept either form, so flipping this is a server-side-only change.

Constant Summary collapse

SEPARATORS =
['/', '_'].freeze
DEFAULT_NAME_SEPARATOR =

The shipped default. Stays '/' until the next major version, when it becomes '_'. Apps opt in early via Config.name_separator = '_'.

'/'
@@name_separator =
DEFAULT_NAME_SEPARATOR

Class Method Summary collapse

Class Method Details

.name_separatorObject



26
27
28
# File 'lib/glib/json_ui/config.rb', line 26

def self.name_separator
  @@name_separator
end

.name_separator=(value) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/glib/json_ui/config.rb', line 30

def self.name_separator=(value)
  value = value.to_s
  unless SEPARATORS.include?(value)
    raise ArgumentError, "Invalid name separator: #{value.inspect}. Allowed: #{SEPARATORS.map(&:inspect).join(', ')}"
  end

  @@name_separator = value
end