Class: Minescope::Transcoder::PrettyPrinter
- Inherits:
-
Object
- Object
- Minescope::Transcoder::PrettyPrinter
- Defined in:
- lib/minescope/transcoder.rb
Instance Method Summary collapse
- #close_object ⇒ Object
- #field_separator ⇒ Object
- #indent_field ⇒ Object
-
#initialize ⇒ PrettyPrinter
constructor
A new instance of PrettyPrinter.
- #item_separator ⇒ Object
- #name_value_separator ⇒ Object
- #open_object ⇒ Object
Constructor Details
#initialize ⇒ PrettyPrinter
Returns a new instance of PrettyPrinter.
21 22 23 |
# File 'lib/minescope/transcoder.rb', line 21 def initialize @indent = 0 end |
Instance Method Details
#close_object ⇒ Object
36 37 38 39 |
# File 'lib/minescope/transcoder.rb', line 36 def close_object @indent -= 1 "\n#{indent_field}}" end |
#field_separator ⇒ Object
34 |
# File 'lib/minescope/transcoder.rb', line 34 def field_separator ; ",\n" end |
#indent_field ⇒ Object
32 |
# File 'lib/minescope/transcoder.rb', line 32 def indent_field ; " " * @indent end |
#item_separator ⇒ Object
25 |
# File 'lib/minescope/transcoder.rb', line 25 def item_separator ; ", " end |
#name_value_separator ⇒ Object
33 |
# File 'lib/minescope/transcoder.rb', line 33 def name_value_separator ; ": " end |
#open_object ⇒ Object
27 28 29 30 |
# File 'lib/minescope/transcoder.rb', line 27 def open_object @indent += 1 "{\n" end |