psych 2.0.17 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -2
  3. data/ext/psych/extconf.rb +1 -0
  4. data/ext/psych/yaml/loader.c +2 -2
  5. data/ext/psych/yaml/scanner.c +17 -17
  6. data/lib/psych.rb +14 -8
  7. data/lib/psych/class_loader.rb +1 -0
  8. data/lib/psych/coder.rb +1 -0
  9. data/lib/psych/core_ext.rb +1 -0
  10. data/lib/psych/deprecated.rb +1 -0
  11. data/lib/psych/exception.rb +1 -0
  12. data/lib/psych/handler.rb +1 -0
  13. data/lib/psych/handlers/document_stream.rb +1 -0
  14. data/lib/psych/handlers/recorder.rb +1 -0
  15. data/lib/psych/json/ruby_events.rb +1 -0
  16. data/lib/psych/json/stream.rb +1 -0
  17. data/lib/psych/json/tree_builder.rb +1 -0
  18. data/lib/psych/json/yaml_events.rb +1 -0
  19. data/lib/psych/nodes.rb +1 -0
  20. data/lib/psych/nodes/alias.rb +1 -0
  21. data/lib/psych/nodes/document.rb +1 -0
  22. data/lib/psych/nodes/mapping.rb +1 -0
  23. data/lib/psych/nodes/node.rb +1 -0
  24. data/lib/psych/nodes/scalar.rb +1 -0
  25. data/lib/psych/nodes/sequence.rb +1 -0
  26. data/lib/psych/nodes/stream.rb +1 -0
  27. data/lib/psych/omap.rb +1 -0
  28. data/lib/psych/parser.rb +1 -0
  29. data/lib/psych/scalar_scanner.rb +1 -0
  30. data/lib/psych/set.rb +1 -0
  31. data/lib/psych/stream.rb +1 -0
  32. data/lib/psych/streaming.rb +1 -0
  33. data/lib/psych/syntax_error.rb +1 -0
  34. data/lib/psych/tree_builder.rb +1 -0
  35. data/lib/psych/versions.rb +1 -0
  36. data/lib/psych/visitors.rb +1 -0
  37. data/lib/psych/visitors/depth_first.rb +1 -0
  38. data/lib/psych/visitors/emitter.rb +1 -0
  39. data/lib/psych/visitors/json_tree.rb +1 -0
  40. data/lib/psych/visitors/to_ruby.rb +1 -0
  41. data/lib/psych/visitors/visitor.rb +1 -0
  42. data/lib/psych/visitors/yaml_tree.rb +3 -2
  43. data/lib/psych/y.rb +1 -0
  44. data/lib/psych_jars.rb +1 -0
  45. data/test/psych/handlers/test_recorder.rb +1 -0
  46. data/test/psych/helper.rb +1 -0
  47. data/test/psych/json/test_stream.rb +1 -0
  48. data/test/psych/nodes/test_enumerable.rb +1 -0
  49. data/test/psych/test_alias_and_anchor.rb +1 -0
  50. data/test/psych/test_array.rb +1 -0
  51. data/test/psych/test_boolean.rb +1 -0
  52. data/test/psych/test_class.rb +1 -0
  53. data/test/psych/test_coder.rb +1 -0
  54. data/test/psych/test_date_time.rb +1 -0
  55. data/test/psych/test_deprecated.rb +1 -0
  56. data/test/psych/test_document.rb +1 -0
  57. data/test/psych/test_emitter.rb +18 -0
  58. data/test/psych/test_encoding.rb +1 -0
  59. data/test/psych/test_exception.rb +1 -0
  60. data/test/psych/test_hash.rb +1 -0
  61. data/test/psych/test_json_tree.rb +1 -0
  62. data/test/psych/test_merge_keys.rb +1 -0
  63. data/test/psych/test_nil.rb +1 -0
  64. data/test/psych/test_null.rb +1 -0
  65. data/test/psych/test_numeric.rb +1 -0
  66. data/test/psych/test_object.rb +1 -0
  67. data/test/psych/test_object_references.rb +1 -0
  68. data/test/psych/test_omap.rb +1 -0
  69. data/test/psych/test_parser.rb +1 -0
  70. data/test/psych/test_psych.rb +6 -0
  71. data/test/psych/test_safe_load.rb +1 -0
  72. data/test/psych/test_scalar.rb +1 -0
  73. data/test/psych/test_scalar_scanner.rb +1 -0
  74. data/test/psych/test_serialize_subclasses.rb +1 -0
  75. data/test/psych/test_set.rb +1 -0
  76. data/test/psych/test_stream.rb +1 -0
  77. data/test/psych/test_string.rb +1 -0
  78. data/test/psych/test_struct.rb +1 -0
  79. data/test/psych/test_symbol.rb +1 -0
  80. data/test/psych/test_tainted.rb +1 -0
  81. data/test/psych/test_to_yaml_properties.rb +1 -0
  82. data/test/psych/test_tree_builder.rb +1 -0
  83. data/test/psych/test_yaml.rb +1 -0
  84. data/test/psych/test_yamldbm.rb +1 -0
  85. data/test/psych/test_yamlstore.rb +1 -0
  86. data/test/psych/visitors/test_depth_first.rb +1 -0
  87. data/test/psych/visitors/test_emitter.rb +1 -0
  88. data/test/psych/visitors/test_to_ruby.rb +1 -0
  89. data/test/psych/visitors/test_yaml_tree.rb +7 -0
  90. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a9fdcc8727893ffe7ccd66cf32401b72ff86fad
4
- data.tar.gz: 22d7e780500881d2546c34c51bcf65a890a347e5
3
+ metadata.gz: b60d3bf3233df7c3abe9184e81b79eed85129ba1
4
+ data.tar.gz: b06bdbf39cd19feaf29b19d5fb49f2d0ae6cfe0e
5
5
  SHA512:
6
- metadata.gz: 18c15c9774386d4e93162a1d70e1076685f69e608dc9c4c346c8a1a151df889069d3b321ef256cf3d9ad921a0803482d66d07aee7af381c486797ca76fd1a2aa
7
- data.tar.gz: b696358e33d033de35d43ab716301b7e7a1503de58db371f91541b46fa0a7796673c72a03d30eb7f4338ddb640f7d86017779855de9a71656115a237bec2858e
6
+ metadata.gz: d9a6914218ecaece3214bb8698a6589bb67b3ded99be295fee23894be97e40dac2c67ca730c4c8c7bf12bc89e68ec7974132adb3a81f6f8f54ae8507fda324a6
7
+ data.tar.gz: 105c008b421b79781e25f041a4f5d9ddc99fbf79b8a0db1fad1329abee305387fd10156612279daf0bdcaa4baaf1c13382cef0164833ca9e4fc52448e87060c4
@@ -1,7 +1,8 @@
1
1
  rvm:
2
2
  - 2.0.0
3
- - 2.1.0
4
- - 2.2.0
3
+ - 2.1
4
+ - 2.2
5
+ - 2.3.0
5
6
  - ruby-head
6
7
  - rbx-2
7
8
  before_script:
@@ -11,4 +12,5 @@ before_script:
11
12
  script: rake test
12
13
  matrix:
13
14
  allow_failures:
15
+ - rvm: ruby-head
14
16
  - rvm: rbx-2
@@ -1,4 +1,5 @@
1
1
  # -*- coding: us-ascii -*-
2
+ # frozen_string_literal: false
2
3
  require 'mkmf'
3
4
  require 'fileutils'
4
5
 
@@ -239,8 +239,8 @@ yaml_parser_register_anchor(yaml_parser_t *parser,
239
239
  if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
240
240
  yaml_free(anchor);
241
241
  return yaml_parser_set_composer_error_context(parser,
242
- "found duplicate anchor; first occurence",
243
- alias_data->mark, "second occurence", data.mark);
242
+ "found duplicate anchor; first occurrence",
243
+ alias_data->mark, "second occurrence", data.mark);
244
244
  }
245
245
  }
246
246
 
@@ -1251,7 +1251,7 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
1251
1251
 
1252
1252
  /*
1253
1253
  * Pop indentation levels from the indents stack until the current level
1254
- * becomes less or equal to the column. For each intendation level, append
1254
+ * becomes less or equal to the column. For each indentation level, append
1255
1255
  * the BLOCK-END token.
1256
1256
  */
1257
1257
 
@@ -1266,7 +1266,7 @@ yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
1266
1266
  if (parser->flow_level)
1267
1267
  return 1;
1268
1268
 
1269
- /* Loop through the intendation levels in the stack. */
1269
+ /* Loop through the indentation levels in the stack. */
1270
1270
 
1271
1271
  while (parser->indent > column)
1272
1272
  {
@@ -2775,15 +2775,15 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2775
2775
 
2776
2776
  if (IS_DIGIT(parser->buffer))
2777
2777
  {
2778
- /* Check that the intendation is greater than 0. */
2778
+ /* Check that the indentation is greater than 0. */
2779
2779
 
2780
2780
  if (CHECK(parser->buffer, '0')) {
2781
2781
  yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
2782
- start_mark, "found an intendation indicator equal to 0");
2782
+ start_mark, "found an indentation indicator equal to 0");
2783
2783
  goto error;
2784
2784
  }
2785
2785
 
2786
- /* Get the intendation level and eat the indicator. */
2786
+ /* Get the indentation level and eat the indicator. */
2787
2787
 
2788
2788
  increment = AS_DIGIT(parser->buffer);
2789
2789
 
@@ -2797,7 +2797,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2797
2797
  {
2798
2798
  if (CHECK(parser->buffer, '0')) {
2799
2799
  yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
2800
- start_mark, "found an intendation indicator equal to 0");
2800
+ start_mark, "found an indentation indicator equal to 0");
2801
2801
  goto error;
2802
2802
  }
2803
2803
 
@@ -2847,7 +2847,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2847
2847
 
2848
2848
  end_mark = parser->mark;
2849
2849
 
2850
- /* Set the intendation level if it was specified. */
2850
+ /* Set the indentation level if it was specified. */
2851
2851
 
2852
2852
  if (increment) {
2853
2853
  indent = parser->indent >= 0 ? parser->indent+increment : increment;
@@ -2913,7 +2913,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2913
2913
 
2914
2914
  if (!READ_LINE(parser, leading_break)) goto error;
2915
2915
 
2916
- /* Eat the following intendation spaces and line breaks. */
2916
+ /* Eat the following indentation spaces and line breaks. */
2917
2917
 
2918
2918
  if (!yaml_parser_scan_block_scalar_breaks(parser,
2919
2919
  &indent, &trailing_breaks, start_mark, &end_mark)) goto error;
@@ -2948,8 +2948,8 @@ error:
2948
2948
  }
2949
2949
 
2950
2950
  /*
2951
- * Scan intendation spaces and line breaks for a block scalar. Determine the
2952
- * intendation level if needed.
2951
+ * Scan indentation spaces and line breaks for a block scalar. Determine the
2952
+ * indentation level if needed.
2953
2953
  */
2954
2954
 
2955
2955
  static int
@@ -2961,11 +2961,11 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
2961
2961
 
2962
2962
  *end_mark = parser->mark;
2963
2963
 
2964
- /* Eat the intendation spaces and line breaks. */
2964
+ /* Eat the indentation spaces and line breaks. */
2965
2965
 
2966
2966
  while (1)
2967
2967
  {
2968
- /* Eat the intendation spaces. */
2968
+ /* Eat the indentation spaces. */
2969
2969
 
2970
2970
  if (!CACHE(parser, 1)) return 0;
2971
2971
 
@@ -2978,12 +2978,12 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
2978
2978
  if ((int)parser->mark.column > max_indent)
2979
2979
  max_indent = (int)parser->mark.column;
2980
2980
 
2981
- /* Check for a tab character messing the intendation. */
2981
+ /* Check for a tab character messing the indentation. */
2982
2982
 
2983
2983
  if ((!*indent || (int)parser->mark.column < *indent)
2984
2984
  && IS_TAB(parser->buffer)) {
2985
2985
  return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
2986
- start_mark, "found a tab character where an intendation space is expected");
2986
+ start_mark, "found a tab character where an indentation space is expected");
2987
2987
  }
2988
2988
 
2989
2989
  /* Have we found a non-empty line? */
@@ -3504,12 +3504,12 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
3504
3504
  {
3505
3505
  if (IS_BLANK(parser->buffer))
3506
3506
  {
3507
- /* Check for tab character that abuse intendation. */
3507
+ /* Check for tab character that abuse indentation. */
3508
3508
 
3509
3509
  if (leading_blanks && (int)parser->mark.column < indent
3510
3510
  && IS_TAB(parser->buffer)) {
3511
3511
  yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
3512
- start_mark, "found a tab character that violate intendation");
3512
+ start_mark, "found a tab character that violate indentation");
3513
3513
  goto error;
3514
3514
  }
3515
3515
 
@@ -3542,7 +3542,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
3542
3542
  if (!CACHE(parser, 1)) goto error;
3543
3543
  }
3544
3544
 
3545
- /* Check intendation level. */
3545
+ /* Check indentation level. */
3546
3546
 
3547
3547
  if (!parser->flow_level && (int)parser->mark.column < indent)
3548
3548
  break;
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  case RUBY_ENGINE
2
3
  when 'jruby'
3
4
  require 'psych_jars'
@@ -223,11 +224,13 @@ require 'psych/class_loader'
223
224
 
224
225
  module Psych
225
226
  # The version is Psych you're using
226
- VERSION = '2.0.17'
227
+ VERSION = '2.1.0'
227
228
 
228
229
  # The version of libyaml Psych is using
229
230
  LIBYAML_VERSION = Psych.libyaml_version.join '.'
230
231
 
232
+ FALLBACK = Struct.new :to_ruby # :nodoc:
233
+
231
234
  ###
232
235
  # Load +yaml+ in to a Ruby data structure. If multiple documents are
233
236
  # provided, the object contained in the first document will be returned.
@@ -247,8 +250,8 @@ module Psych
247
250
  # ex.file # => 'file.txt'
248
251
  # ex.message # => "(file.txt): found character that cannot start any token"
249
252
  # end
250
- def self.load yaml, filename = nil
251
- result = parse(yaml, filename)
253
+ def self.load yaml, filename = nil, fallback = false
254
+ result = parse(yaml, filename, fallback)
252
255
  result ? result.to_ruby : result
253
256
  end
254
257
 
@@ -320,11 +323,11 @@ module Psych
320
323
  # end
321
324
  #
322
325
  # See Psych::Nodes for more information about YAML AST.
323
- def self.parse yaml, filename = nil
326
+ def self.parse yaml, filename = nil, fallback = false
324
327
  parse_stream(yaml, filename) do |node|
325
328
  return node
326
329
  end
327
- false
330
+ fallback
328
331
  end
329
332
 
330
333
  ###
@@ -465,9 +468,12 @@ module Psych
465
468
 
466
469
  ###
467
470
  # Load the document contained in +filename+. Returns the yaml contained in
468
- # +filename+ as a Ruby object
469
- def self.load_file filename
470
- File.open(filename, 'r:bom|utf-8') { |f| self.load f, filename }
471
+ # +filename+ as a Ruby object, or if the file is empty, it returns
472
+ # the specified default return value, which defaults to an empty Hash
473
+ def self.load_file filename, fallback = false
474
+ File.open(filename, 'r:bom|utf-8') { |f|
475
+ self.load f, filename, FALLBACK.new(fallback)
476
+ }
471
477
  end
472
478
 
473
479
  # :stopdoc:
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/omap'
2
3
  require 'psych/set'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # If an object defines +encode_with+, then an instance of Psych::Coder will
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  class Object
2
3
  def self.yaml_tag url
3
4
  Psych.add_tag(url, self)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'date'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  class Exception < RuntimeError
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # Psych::Handler is an abstract base class that defines the events used
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/tree_builder'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/handler'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module JSON
3
4
  module RubyEvents # :nodoc:
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/json/ruby_events'
2
3
  require 'psych/json/yaml_events'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/json/yaml_events'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module JSON
3
4
  module YAMLEvents # :nodoc:
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/nodes/node'
2
3
  require 'psych/nodes/stream'
3
4
  require 'psych/nodes/document'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'stringio'
2
3
  require 'psych/class_loader'
3
4
  require 'psych/scalar_scanner'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  class Omap < ::Hash
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # YAML event parser class. This class parses a YAML document and calls
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'strscan'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  class Set < ::Hash
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # Psych::Stream is a streaming YAML emitter. It will not buffer your YAML,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Streaming
3
4
  module ClassMethods
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/exception'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/handler'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  DEFAULT_SNAKEYAML_VERSION = '1.14'.freeze
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/visitors/visitor'
2
3
  require 'psych/visitors/to_ruby'
3
4
  require 'psych/visitors/emitter'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Visitors
3
4
  class DepthFirst < Psych::Visitors::Visitor
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Visitors
3
4
  class Emitter < Psych::Visitors::Visitor
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/json/ruby_events'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/scalar_scanner'
2
3
  require 'psych/class_loader'
3
4
  require 'psych/exception'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Visitors
3
4
  class Visitor
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/tree_builder'
2
3
  require 'psych/scalar_scanner'
3
4
  require 'psych/class_loader'
@@ -313,7 +314,7 @@ module Psych
313
314
  tag = nil
314
315
 
315
316
  if binary?(o)
316
- o = [o].pack('m').chomp
317
+ o = [o].pack('m0')
317
318
  tag = '!binary' # FIXME: change to below when syck is removed
318
319
  #tag = 'tag:yaml.org,2002:binary'
319
320
  style = Nodes::Scalar::LITERAL
@@ -330,7 +331,7 @@ module Psych
330
331
  style = Nodes::Scalar::FOLDED
331
332
  elsif o =~ /^[^[:word:]][^"]*$/
332
333
  style = Nodes::Scalar::DOUBLE_QUOTED
333
- elsif not String === @ss.tokenize(o)
334
+ elsif not String === @ss.tokenize(o) or /\A0[0-7]*[89]/ =~ o
334
335
  style = Nodes::Scalar::SINGLE_QUOTED
335
336
  end
336
337
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Kernel
2
3
  ###
3
4
  # An alias for Psych.dump_stream meant to be used with IRB.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/versions'
2
3
  require 'psych.jar'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/helper'
2
3
  require 'psych/handlers/recorder'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'minitest/autorun'
2
3
  require 'stringio'
3
4
  require 'tempfile'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  class ObjectWithInstanceVariables
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
  require 'date'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: false
2
3
 
3
4
  require_relative 'helper'
4
5
 
@@ -89,5 +90,22 @@ module Psych
89
90
  @emitter.start_sequence(nil, nil, true, :foo)
90
91
  end
91
92
  end
93
+
94
+ def test_resizing_tags
95
+ @emitter.start_stream Psych::Nodes::Stream::UTF8
96
+
97
+ tags = []
98
+ version = [1,1]
99
+ obj = Object.new
100
+ obj.instance_variable_set(:@tags, tags)
101
+ def obj.to_str
102
+ (1..10).map{|x| @tags.push(["AAAA","BBBB"])}
103
+ return "x"
104
+ end
105
+
106
+ tags.push([obj, "tag:TALOS"])
107
+ @emitter.start_document(version, tags, 0)
108
+ assert(true)
109
+ end
92
110
  end
93
111
  end
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: false
2
3
 
3
4
  require_relative 'helper'
4
5
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
  require 'bigdecimal'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: false
2
3
 
3
4
  require_relative 'helper'
4
5
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  require 'stringio'
@@ -143,6 +144,11 @@ class TestPsych < Psych::TestCase
143
144
  }
144
145
  end
145
146
 
147
+ def test_load_file_with_fallback
148
+ t = Tempfile.create(['empty', 'yml'])
149
+ assert_equal Hash.new, Psych.load_file(t.path, Hash.new)
150
+ end
151
+
146
152
  def test_parse_file
147
153
  Tempfile.create(['yikes', 'yml']) {|t|
148
154
  t.binmode
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/helper'
2
3
 
3
4
  module Psych
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: false
2
3
 
3
4
  require_relative 'helper'
4
5
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
  require 'date'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,4 +1,5 @@
1
1
  # encoding: UTF-8
2
+ # frozen_string_literal: false
2
3
  require_relative 'helper'
3
4
 
4
5
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  class PsychStructWithIvar < Struct.new(:foo)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
 
3
4
  module Psych
@@ -1,4 +1,5 @@
1
1
  # -*- coding: us-ascii; mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
2
+ # frozen_string_literal: false
2
3
  # vim:sw=4:ts=4
3
4
  # $Id$
4
5
  #
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
  require 'tmpdir'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require_relative 'helper'
2
3
  require 'yaml/store'
3
4
  require 'tmpdir'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/helper'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/helper'
2
3
 
3
4
  module Psych
@@ -1,4 +1,5 @@
1
1
  # coding: US-ASCII
2
+ # frozen_string_literal: false
2
3
  require 'psych/helper'
3
4
 
4
5
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/helper'
2
3
 
3
4
  module Psych
@@ -155,6 +156,12 @@ module Psych
155
156
  assert_equal(-1, Psych.load(Psych.dump(-1 / 0.0)).infinite?)
156
157
  end
157
158
 
159
+ def test_string
160
+ assert_match(/'017'/, Psych.dump({'a' => '017'}))
161
+ assert_match(/'019'/, Psych.dump({'a' => '019'}))
162
+ assert_match(/'01818'/, Psych.dump({'a' => '01818'}))
163
+ end
164
+
158
165
  # http://yaml.org/type/null.html
159
166
  def test_nil
160
167
  assert_cycle nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.17
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-22 00:00:00.000000000 Z
11
+ date: 2016-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.14'
61
+ version: '3.15'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.14'
68
+ version: '3.15'
69
69
  description: |-
70
70
  Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
71
71
  for its YAML parsing and emitting capabilities. In addition to wrapping