Class: AbideDevUtils::Sce::Generate::Reference::ControlMarkdown

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/sce/generate/reference.rb

Overview

Generates markdown for a control

Instance Method Summary collapse

Constructor Details

#initialize(control, md, strings, module_name, framework, formatter: nil, opts: {}) ⇒ ControlMarkdown

Returns a new instance of ControlMarkdown.



230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 230

def initialize(control, md, strings, module_name, framework, formatter: nil, opts: {})
  @control = control
  @md = md
  @strings = strings
  @module_name = module_name
  @framework = framework
  @formatter = formatter.nil? ? TypeExprValueFormatter : formatter
  @opts = opts
  @valid_level = []
  @valid_profile = []
  @control_data = {}
end

Instance Method Details

#generate!Object



243
244
245
246
247
248
249
250
251
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 243

def generate!
  heading_builder
  control_params_builder
  control_profiles_levels_builder
  config_example_builder
  control_alternate_ids_builder
  dependent_controls_builder
  resource_reference_builder
end

#verify_profile_and_level_selectionsBoolean

This function gets the array of string representations of profiles and levels from the control based on selection filters in opts, if any.

Returns:

  • (Boolean)

    if valid profiles and levels were extracted from the control.



256
257
258
259
260
261
262
263
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 256

def verify_profile_and_level_selections
  @valid_profs_lvls = @control.filtered_profiles_levels(
    prof: @opts[:select_profile],
    lvl: @opts[:select_level]
  )
  @valid_profs_lvls.uniq!
  !@valid_profs_lvls.empty?
end