Class: SchemaRegistry::Output::ProtoText::Writer
- Inherits:
-
StringIO
- Object
- StringIO
- SchemaRegistry::Output::ProtoText::Writer
- Defined in:
- lib/schema_registry_client/output/proto_text.rb
Instance Method Summary collapse
- #dedent ⇒ Object
- #indent ⇒ Object
-
#initialize ⇒ Writer
constructor
A new instance of Writer.
- #write_indent(str) ⇒ Object
- #write_line(line, newline = 1) ⇒ Object
- #writenl ⇒ Object
Constructor Details
#initialize ⇒ Writer
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
#dedent ⇒ Object
38 39 40 |
# File 'lib/schema_registry_client/output/proto_text.rb', line 38 def dedent @indent -= 2 end |
#indent ⇒ Object
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 |
#writenl ⇒ Object
30 31 32 |
# File 'lib/schema_registry_client/output/proto_text.rb', line 30 def writenl write("\n") end |