Class: Lagoon::Diagram::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/lagoon/diagram/base.rb,
sig/lagoon.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = nil, configuration: Lagoon.configuration.dup, **keyword_options) ⇒ Base

Returns a new instance of Base.

Parameters:

  • options (options_hash, nil) (defaults to: nil)
  • configuration: (Configuration) (defaults to: Lagoon.configuration.dup)
  • keyword_options (Object)


11
12
13
14
15
# File 'lib/lagoon/diagram/base.rb', line 11

def initialize(options = nil, configuration: Lagoon.configuration.dup, **keyword_options)
  @config = configuration
  raw_options = (options || {}).to_h.merge(keyword_options)
  @options = Options.for(diagram_kind, raw_options, config: @config)
end

Instance Attribute Details

#configConfiguration (readonly)

Returns the value of attribute config.

Returns:



9
10
11
# File 'lib/lagoon/diagram/base.rb', line 9

def config
  @config
end

#optionsOptions (readonly)

Returns the value of attribute options.

Returns:



9
10
11
# File 'lib/lagoon/diagram/base.rb', line 9

def options
  @options
end

Instance Method Details

#generateResult

Returns:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lagoon/diagram/base.rb', line 17

def generate
  parsed_data = parser.parse
  content = renderer.render(parsed_data)
  path = write_to_file(content)
  Result.new(
    path: path,
    content: content,
    warnings: parsed_data.fetch(:warnings, []),
    counts: parsed_data.fetch(:counts, infer_counts(parsed_data))
  )
end