Class: Lutaml::UmlRepository::StaticSite::Generator
- Inherits:
-
Object
- Object
- Lutaml::UmlRepository::StaticSite::Generator
- Defined in:
- lib/lutaml/uml_repository/static_site/generator.rb
Overview
Main static site generator for LutaML UML Browser.
Follows Dependency Inversion Principle by injecting dependencies and using external configuration instead of hardcoded values.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#generate ⇒ String
Generate the static site.
-
#initialize(repository, options = {}) ⇒ Generator
constructor
Initialize generator with dependency injection.
Constructor Details
#initialize(repository, options = {}) ⇒ Generator
Initialize generator with dependency injection
(default: auto-loaded) transformer instance builder instance (:single_file or :multi_file)
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 70 def initialize(repository, = {}) # rubocop:disable Metrics/MethodLength @repository = repository @config = [:config] || Configuration.load([:config_path]) @options = () # Dependency injection for testability @id_generator = [:id_generator] || IDGenerator.new @data_transformer = [:data_transformer] || create_data_transformer @search_builder = [:search_builder] || create_search_builder @liquid = setup_liquid end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
53 54 55 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 53 def config @config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
53 54 55 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 53 def @options end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
53 54 55 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 53 def repository @repository end |
Instance Method Details
#generate ⇒ String
Generate the static site
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 89 def generate case @options[:mode] when :single_file generate_single_file when :multi_file generate_multi_file else raise ArgumentError, "Invalid mode: #{@options[:mode]}. " \ "Use :single_file or :multi_file" end end |