File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -933,6 +933,7 @@ def initialize(path)
933
933
@is_first_obj = true
934
934
write_new_line
935
935
end
936
+
936
937
def write_object
937
938
if @is_first_obj
938
939
@is_first_obj = false
@@ -953,6 +954,7 @@ def write_object
953
954
@indent_level -= 1
954
955
@is_first_key_val = true
955
956
end
957
+
956
958
def write_array ( key )
957
959
@indent_level += 1
958
960
write_indent
@@ -961,6 +963,7 @@ def write_array(key)
961
963
@file . write ( " " , "[" )
962
964
write_new_line
963
965
end
966
+
964
967
def write_key_value ( key , value )
965
968
if @is_first_key_val
966
969
@is_first_key_val = false
@@ -974,28 +977,35 @@ def write_key_value(key, value)
974
977
@file . write ( " " )
975
978
@file . write ( to_json_str ( value ) )
976
979
end
980
+
977
981
def close
978
982
close_array
979
983
@indent_level -= 1
980
984
write_new_line
981
985
@file . write ( "}" )
982
986
end
987
+
983
988
private
984
989
def to_json_str ( obj )
985
990
JSON . dump ( obj )
986
991
end
992
+
987
993
def write_indent
988
994
@file . write ( " " * 2 * @indent_level )
989
995
end
996
+
990
997
def write_new_line
991
998
@file . write ( "\n " )
992
999
end
1000
+
993
1001
def write_comma
994
1002
@file . write ( ',' )
995
1003
end
1004
+
996
1005
def write_colon
997
1006
@file . write ( ":" )
998
1007
end
1008
+
999
1009
def close_array
1000
1010
write_new_line
1001
1011
write_indent
You can’t perform that action at this time.
0 commit comments