Class: Scalar::Config
- Inherits:
-
Object
- Object
- Scalar::Config
- Includes:
- Singleton
- Defined in:
- lib/scalar/config.rb
Constant Summary collapse
- DEFAULT_LIBRARY_URL =
'https://cdn.jsdelivr.net/npm/@scalar/api-reference'- DEFAULT_PAGE_TITLE =
'API Reference'- DEFAULT_CONFIGURATION =
{}.freeze
- DEMO_CONFIGURATION =
{ url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml' }.freeze
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#library_url ⇒ Object
Returns the value of attribute library_url.
-
#page_title ⇒ Object
Returns the value of attribute page_title.
Instance Method Summary collapse
- #configuration_to_json ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #set_defaults ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
22 23 24 |
# File 'lib/scalar/config.rb', line 22 def initialize set_defaults end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
18 19 20 |
# File 'lib/scalar/config.rb', line 18 def configuration @configuration end |
#library_url ⇒ Object
Returns the value of attribute library_url.
18 19 20 |
# File 'lib/scalar/config.rb', line 18 def library_url @library_url end |
#page_title ⇒ Object
Returns the value of attribute page_title.
18 19 20 |
# File 'lib/scalar/config.rb', line 18 def page_title @page_title end |
Instance Method Details
#configuration_to_json ⇒ Object
26 27 28 29 30 |
# File 'lib/scalar/config.rb', line 26 def configuration_to_json return JSON.dump(DEMO_CONFIGURATION) if configuration == :demo JSON.dump(configuration) end |
#set_defaults ⇒ Object
32 33 34 35 36 |
# File 'lib/scalar/config.rb', line 32 def set_defaults @library_url = DEFAULT_LIBRARY_URL @page_title = DEFAULT_PAGE_TITLE @configuration = DEFAULT_CONFIGURATION end |