Class: FixA11yGenerator

Inherits:
Sublayer::Generators::Base
  • Object
show all
Defined in:
lib/generators/fix_a11y_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(contents:, issue:, extension: '', additional_prompt: nil) ⇒ FixA11yGenerator

Returns a new instance of FixA11yGenerator.



6
7
8
9
10
11
# File 'lib/generators/fix_a11y_generator.rb', line 6

def initialize(contents:, issue:, extension: '', additional_prompt: nil)
  @extension = extension
  @contents = contents
  @issue = issue
  @additional_prompt = additional_prompt
end

Instance Method Details

#generateObject



13
14
15
# File 'lib/generators/fix_a11y_generator.rb', line 13

def generate
  super
end

#promptObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/generators/fix_a11y_generator.rb', line 17

def prompt
  <<~PROMPT
    Given the following #{@extension} template contents and an
    accessibility issue, generate a new #{@extension} file with the
    issue fixed, leaving the rest of the contents unchanged.

    #{@extension} code:
    #{@contents}

    Accessibility issue:
    #{@issue}

    Additional user instructions (if any):
    #{@additional_prompt || 'None'}

    Return the contents with the issue fixed.
  PROMPT
end