Class: AskChatgpt::Helpers::DummyInputMethod
- Inherits:
-
IRB::InputMethod
- Object
- IRB::InputMethod
- AskChatgpt::Helpers::DummyInputMethod
- Defined in:
- lib/ask_chatgpt/helpers.rb
Instance Attribute Summary collapse
-
#line_no ⇒ Object
readonly
Returns the value of attribute line_no.
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
- #encoding ⇒ Object
- #eof? ⇒ Boolean
- #gets ⇒ Object
-
#initialize(list = []) ⇒ DummyInputMethod
constructor
A new instance of DummyInputMethod.
- #reset ⇒ Object
Constructor Details
#initialize(list = []) ⇒ DummyInputMethod
Returns a new instance of DummyInputMethod.
29 30 31 32 33 |
# File 'lib/ask_chatgpt/helpers.rb', line 29 def initialize(list = []) super("test") @line_no = 0 @list = list end |
Instance Attribute Details
#line_no ⇒ Object (readonly)
Returns the value of attribute line_no.
27 28 29 |
# File 'lib/ask_chatgpt/helpers.rb', line 27 def line_no @line_no end |
#list ⇒ Object (readonly)
Returns the value of attribute list.
27 28 29 |
# File 'lib/ask_chatgpt/helpers.rb', line 27 def list @list end |
Instance Method Details
#encoding ⇒ Object
43 44 45 |
# File 'lib/ask_chatgpt/helpers.rb', line 43 def encoding Encoding.default_external end |
#eof? ⇒ Boolean
39 40 41 |
# File 'lib/ask_chatgpt/helpers.rb', line 39 def eof? @line_no >= @list.size end |
#gets ⇒ Object
35 36 37 |
# File 'lib/ask_chatgpt/helpers.rb', line 35 def gets @list[@line_no]&.tap {@line_no += 1} end |
#reset ⇒ Object
47 48 49 |
# File 'lib/ask_chatgpt/helpers.rb', line 47 def reset @line_no = 0 end |