Class: FixA11yGenerator

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of FixA11yGenerator.



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

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

Instance Method Details

#generateObject



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

def generate
  super
end

#promptObject



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

def prompt
  <<~PROMPT
    Given the following JSX contents and an individual accessibility issue, generate a new JSX file with the individual issue fixed, leaving the rest of the contents unchanged.:

    Code:
    #{@contents}

    Accessibility issue:
    #{@issue}

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

    Return the JSX contents with the issue fixed.
  PROMPT
end