Class: SyntaxSuggest::MiniStringIO

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_suggest/core_ext.rb

Overview

Mini String IO [Private]

Acts like a StringIO with reduced API, but without having to require that class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(isatty: $stderr.isatty) ⇒ MiniStringIO

Returns a new instance of MiniStringIO.



11
12
13
14
# File 'lib/syntax_suggest/core_ext.rb', line 11

def initialize(isatty: $stderr.isatty)
  @string = +""
  @isatty = isatty
end

Instance Attribute Details

#isattyObject (readonly)

Returns the value of attribute isatty.



16
17
18
# File 'lib/syntax_suggest/core_ext.rb', line 16

def isatty
  @isatty
end

#stringObject (readonly)

Returns the value of attribute string.



21
22
23
# File 'lib/syntax_suggest/core_ext.rb', line 21

def string
  @string
end

Instance Method Details

#puts(value = $/) ⇒ Object



17
18
19
# File 'lib/syntax_suggest/core_ext.rb', line 17

def puts(value = $/, **)
  @string << value
end