Module: AskChatgpt::Sugar

Included in:
Executor
Defined in:
lib/ask_chatgpt/sugar.rb

Instance Method Summary collapse

Instance Method Details

#async!Object



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

def async!
  AskChatGPT.mode = :async
end

#debug!(mode = :on) ⇒ Object



4
5
6
# File 'lib/ask_chatgpt/sugar.rb', line 4

def debug!(mode = :on)
  AskChatGPT.debug = mode == :on
end

#off!(feature) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ask_chatgpt/sugar.rb', line 31

def off!(feature)
  case feature
  when :markdown
    AskChatGPT.markdown = false
  when :debug
    AskChatGPT.debug = false
  when :async
    AskChatGPT.mode = :sync
  when :sync
    AskChatGPT.mode = :async
  else
    raise InputError, "Unknown feature: #{feature}"
  end
end

#on!(feature) ⇒ Object



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

def on!(feature)
  case feature
  when :markdown
    AskChatGPT.markdown = true
  when :debug
    AskChatGPT.debug = true
  when :async
    AskChatGPT.mode = :async
  when :sync
    AskChatGPT.mode = :sync
  else
    raise InputError, "Unknown feature: #{feature}"
  end
end

#sync!Object



8
9
10
# File 'lib/ask_chatgpt/sugar.rb', line 8

def sync!
  AskChatGPT.mode = :sync
end