Class: Lutaml::Jsonschema::Configuration
- Inherits:
-
Object
- Object
- Lutaml::Jsonschema::Configuration
- Defined in:
- lib/lutaml/jsonschema/configuration.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#description ⇒ Object
Returns the value of attribute description.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#theme ⇒ Object
Returns the value of attribute theme.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_metadata ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 11 def initialize @title = nil @version = nil @description = nil @base_url = nil @theme = "light" @output_path = "output" end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
8 9 10 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 8 def base_url @base_url end |
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 8 def description @description end |
#output_path ⇒ Object
Returns the value of attribute output_path.
8 9 10 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 8 def output_path @output_path end |
#theme ⇒ Object
Returns the value of attribute theme.
8 9 10 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 8 def theme @theme end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 8 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
8 9 10 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 8 def version @version end |
Class Method Details
.load_from_file(path) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/lutaml/jsonschema/configuration.rb', line 20 def self.load_from_file(path) return new unless File.exist?(path) data = YAML.safe_load_file(path) config = new return config unless data.is_a?(Hash) config.title = data["title"] if data.key?("title") config.version = data["version"] if data.key?("version") config.description = data["description"] if data.key?("description") config.base_url = data["base_url"] if data.key?("base_url") config.theme = data["theme"] if data.key?("theme") config.output_path = data["output_path"] if data.key?("output_path") config end |