Class: SchemaRegistry::Output::ProtoText::Writer

Inherits:
StringIO
  • Object
show all
Defined in:
lib/schema_registry_client/output/proto_text.rb

Instance Method Summary collapse

Constructor Details

#initializeWriter

Returns a new instance of Writer.



15
16
17
18
# File 'lib/schema_registry_client/output/proto_text.rb', line 15

def initialize(...)
  super
  @indent = 0
end

Instance Method Details

#dedentObject



38
39
40
# File 'lib/schema_registry_client/output/proto_text.rb', line 38

def dedent
  @indent -= 2
end

#indentObject



34
35
36
# File 'lib/schema_registry_client/output/proto_text.rb', line 34

def indent
  @indent += 2
end

#write_indent(str) ⇒ Object



20
21
22
23
# File 'lib/schema_registry_client/output/proto_text.rb', line 20

def write_indent(str)
  @indent.times { write(" ") }
  write(str)
end

#write_line(line, newline = 1) ⇒ Object



25
26
27
28
# File 'lib/schema_registry_client/output/proto_text.rb', line 25

def write_line(line, newline = 1)
  write_indent(line)
  newline.times { writenl }
end

#writenlObject



30
31
32
# File 'lib/schema_registry_client/output/proto_text.rb', line 30

def writenl
  write("\n")
end