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)
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 49 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.
32 33 34 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 32 def config @config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
32 33 34 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 32 def @options end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
32 33 34 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 32 def repository @repository end |
Instance Method Details
#generate ⇒ String
Generate the static site
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/lutaml/uml_repository/static_site/generator.rb', line 68 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 |