Class: Minescope::Transcoder::PrettyPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/minescope/transcoder.rb

Instance Method Summary collapse

Constructor Details

#initializePrettyPrinter

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_objectObject



36
37
38
39
# File 'lib/minescope/transcoder.rb', line 36

def close_object
  @indent -= 1
  "\n#{indent_field}}"
end

#field_separatorObject



34
# File 'lib/minescope/transcoder.rb', line 34

def field_separator ; ",\n" end

#indent_fieldObject



32
# File 'lib/minescope/transcoder.rb', line 32

def indent_field ; "  " * @indent end

#item_separatorObject



25
# File 'lib/minescope/transcoder.rb', line 25

def item_separator ; ", " end

#name_value_separatorObject



33
# File 'lib/minescope/transcoder.rb', line 33

def name_value_separator ; ": " end

#open_objectObject



27
28
29
30
# File 'lib/minescope/transcoder.rb', line 27

def open_object
  @indent += 1
  "{\n"
end