psych 2.2.4-java → 3.0.0.beta2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 462fdd22e9e9b7049177e6fc24a1ba8f6dd40bfb
4
- data.tar.gz: aac6857311058164a21001bc67e3feacb854fe71
2
+ SHA256:
3
+ metadata.gz: 4e51ebd69ee5d66110893f9d5b8ab19107ac922c1beb17f1d90669053ddf895c
4
+ data.tar.gz: 91304f5dbadb947ceb5327490877c6f5af296f9e27f10945ee913c5b6f8f8e0e
5
5
  SHA512:
6
- metadata.gz: 6845cff97c809faf85eb0948bcebc3bea23db688fdd4f8de53116dbe89af250be1c624562c7b3c5013bc18bba309b9577310e06adf8f73fe283ba4e93a028bd4
7
- data.tar.gz: 51db7cdcd70731288d13f775fd9bb504e87e86b43e6d578cc7af5b454ce0883872782be399969e1ae61e0aee1c11153a3b7bb9c0a01b175c72cc589a09222783
6
+ metadata.gz: 43a594024399e2cc34aaf767b1090d2dbb1805eba63d6825ef7529fc82a059837dc6f7680bb3142c038d75dd7e67c6c3de5501e631c084b2acf8b4e9e0648b8d
7
+ data.tar.gz: fbccf933d50176dc05a5f20bcdf9a9e5e1a6ee8e01fe995d861420f8d0cdd126dfb4c53a20156e58b18bfd53b18a1732d70b5295f81ff550d846a2a611f8c8ca
data/.travis.yml CHANGED
@@ -1,15 +1,16 @@
1
1
  rvm:
2
- - 2.1
3
- - 2.2
4
- - 2.3.0
2
+ - 2.2.7
3
+ - 2.3.4
4
+ - 2.4.1
5
5
  - ruby-head
6
- - jruby-9.1.6.0
6
+ - jruby-9.1.8.0
7
7
 
8
8
  matrix:
9
9
  allow_failures:
10
- - rvm: jruby-9.1.6.0
10
+ - rvm: jruby-9.1.8.0
11
11
 
12
- before_install: gem install bundler --no-document
12
+ before_script:
13
+ - unset JRUBY_OPTS
13
14
 
14
15
  script: rake
15
16
 
@@ -158,10 +158,15 @@ public class PsychParser extends RubyObject {
158
158
 
159
159
  // fall back on IOInputStream, using default charset
160
160
  if (yaml.respondsTo("read")) {
161
- Encoding enc = (yaml instanceof RubyIO)
162
- ? ((RubyIO)yaml).getReadEncoding()
163
- : UTF8Encoding.INSTANCE;
164
- Charset charset = enc.getCharset();
161
+ Charset charset = null;
162
+ if (yaml instanceof RubyIO) {
163
+ Encoding enc = ((RubyIO) yaml).getReadEncoding();
164
+ charset = enc.getCharset();
165
+ }
166
+ if (charset == null) {
167
+ // If we can't get it from the IO or it doesn't have a charset, fall back on UTF-8
168
+ charset = UTF8Encoding.INSTANCE.getCharset();
169
+ }
165
170
  return new StreamReader(new InputStreamReader(new IOInputStream(yaml), charset));
166
171
  } else {
167
172
  throw runtime.newTypeError(yaml, runtime.getIO());
@@ -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 indentation. */
3507
+ /* Check for tab characters 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 indentation");
3512
+ start_mark, "found a tab character that violates indentation");
3513
3513
  goto error;
3514
3514
  }
3515
3515
 
data/lib/psych.rb CHANGED
@@ -17,7 +17,6 @@ require 'psych/omap'
17
17
  require 'psych/set'
18
18
  require 'psych/coder'
19
19
  require 'psych/core_ext'
20
- require 'psych/deprecated'
21
20
  require 'psych/stream'
22
21
  require 'psych/json/tree_builder'
23
22
  require 'psych/json/stream'
@@ -4,31 +4,14 @@ class Object
4
4
  Psych.add_tag(url, self)
5
5
  end
6
6
 
7
- # FIXME: rename this to "to_yaml" when syck is removed
8
-
9
7
  ###
10
8
  # call-seq: to_yaml(options = {})
11
9
  #
12
10
  # Convert an object to YAML. See Psych.dump for more information on the
13
11
  # available +options+.
14
- def psych_to_yaml options = {}
12
+ def to_yaml options = {}
15
13
  Psych.dump self, options
16
14
  end
17
- remove_method :to_yaml rescue nil
18
- alias :to_yaml :psych_to_yaml
19
- end
20
-
21
- class Module
22
- def psych_yaml_as url
23
- return if caller[0].end_with?('rubytypes.rb')
24
- if $VERBOSE
25
- warn "#{caller[0]}: yaml_as is deprecated, please use yaml_tag"
26
- end
27
- Psych.add_tag(url, self)
28
- end
29
-
30
- remove_method :yaml_as rescue nil
31
- alias :yaml_as :psych_yaml_as
32
15
  end
33
16
 
34
17
  if defined?(::IRB)
@@ -10,7 +10,6 @@ module Psych
10
10
 
11
11
  # Taken from http://yaml.org/type/float.html
12
12
  FLOAT = /^(?:[-+]?([0-9][0-9_,]*)?\.[0-9]*([eE][-+][0-9]+)?(?# base 10)
13
- |[-+]?[0-9][0-9_,]*(:[0-5]?[0-9])+\.[0-9_]*(?# base 60)
14
13
  |[-+]?\.(inf|Inf|INF)(?# infinity)
15
14
  |\.(nan|NaN|NAN)(?# not a number))$/x
16
15
 
@@ -83,13 +82,13 @@ module Psych
83
82
  else
84
83
  @symbol_cache[string] = class_loader.symbolize(string.sub(/^:/, ''))
85
84
  end
86
- when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+$/
85
+ when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}$/
87
86
  i = 0
88
87
  string.split(':').each_with_index do |n,e|
89
88
  i += (n.to_i * 60 ** (e - 2).abs)
90
89
  end
91
90
  i
92
- when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+\.[0-9_]*$/
91
+ when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}\.[0-9_]*$/
93
92
  i = 0
94
93
  string.split(':').each_with_index do |n,e|
95
94
  i += (n.to_f * 60 ** (e - 2).abs)
@@ -144,7 +143,7 @@ module Psych
144
143
  offset += ((tz[1] || 0) * 60)
145
144
  end
146
145
 
147
- klass.at((time - offset).to_i, us)
146
+ klass.new(yy, m, dd, hh, mm, ss+us/(1_000_000r), offset)
148
147
  end
149
148
  end
150
149
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  module Psych
3
3
  # The version is Psych you're using
4
- VERSION = '2.2.4'
4
+ VERSION = '3.0.0.beta2'
5
5
 
6
6
  if RUBY_ENGINE == 'jruby'
7
7
  DEFAULT_SNAKEYAML_VERSION = '1.18'.freeze
@@ -380,11 +380,6 @@ module Psych
380
380
 
381
381
  if o.respond_to?(:init_with)
382
382
  o.init_with c
383
- elsif o.respond_to?(:yaml_initialize)
384
- if $VERBOSE
385
- warn "Implementing #{o.class}#yaml_initialize is deprecated, please implement \"init_with(coder)\""
386
- end
387
- o.yaml_initialize c.tag, c.map
388
383
  else
389
384
  h.each { |k,v| o.instance_variable_set(:"@#{k}", v) }
390
385
  end
@@ -53,15 +53,6 @@ module Psych
53
53
  new(emitter, ss, options)
54
54
  end
55
55
 
56
- def self.new emitter = nil, ss = nil, options = nil
57
- return super if emitter && ss && options
58
-
59
- if $VERBOSE
60
- warn "This API is deprecated, please pass an emitter, scalar scanner, and options or call #{self}.create() (#{caller.first})"
61
- end
62
- create emitter, ss
63
- end
64
-
65
56
  def initialize emitter, ss, options
66
57
  super()
67
58
  @started = false
@@ -139,24 +130,6 @@ module Psych
139
130
  return @emitter.alias anchor
140
131
  end
141
132
 
142
- if target.respond_to?(:to_yaml)
143
- begin
144
- loc = target.method(:to_yaml).source_location.first
145
- if loc !~ /(syck\/rubytypes.rb|psych\/core_ext.rb)/
146
- unless target.respond_to?(:encode_with)
147
- if $VERBOSE
148
- warn "implementing to_yaml is deprecated, please implement \"encode_with\""
149
- end
150
-
151
- target.to_yaml(:nodump => true)
152
- end
153
- end
154
- rescue
155
- # public_method or source_location might be overridden,
156
- # and it's OK to skip it since it's only to emit a warning
157
- end
158
- end
159
-
160
133
  if target.respond_to?(:encode_with)
161
134
  dump_coder target
162
135
  else
@@ -191,6 +164,8 @@ module Psych
191
164
  @emitter.end_mapping
192
165
  end
193
166
 
167
+ alias :visit_Delegator :visit_Object
168
+
194
169
  def visit_Struct o
195
170
  tag = ['!ruby/struct', o.class.name].compact.join(':')
196
171
 
@@ -336,7 +311,7 @@ module Psych
336
311
  end
337
312
 
338
313
  is_primitive = o.class == ::String
339
- ivars = find_ivars o, is_primitive
314
+ ivars = is_primitive ? [] : o.instance_variables
340
315
 
341
316
  if ivars.empty?
342
317
  unless is_primitive
@@ -527,24 +502,6 @@ module Psych
527
502
  end
528
503
  end
529
504
 
530
- # FIXME: remove this method once "to_yaml_properties" is removed
531
- def find_ivars target, is_primitive=false
532
- begin
533
- loc = target.method(:to_yaml_properties).source_location.first
534
- unless loc.start_with?(Psych::DEPRECATED) || loc.end_with?('rubytypes.rb')
535
- if $VERBOSE
536
- warn "#{loc}: to_yaml_properties is deprecated, please implement \"encode_with(coder)\""
537
- end
538
- return target.to_yaml_properties
539
- end
540
- rescue
541
- # public_method or source_location might be overridden,
542
- # and it's OK to skip it since it's only to emit a warning.
543
- end
544
-
545
- is_primitive ? [] : target.instance_variables
546
- end
547
-
548
505
  def register target, yaml_obj
549
506
  @st.register target, yaml_obj
550
507
  yaml_obj
@@ -586,9 +543,7 @@ module Psych
586
543
  end
587
544
 
588
545
  def dump_ivars target
589
- ivars = find_ivars target
590
-
591
- ivars.each do |iv|
546
+ target.instance_variables.each do |iv|
592
547
  @emitter.scalar("#{iv.to_s.sub(/^@/, '')}", nil, nil, true, false, Nodes::Scalar::ANY)
593
548
  accept target.instance_variable_get(iv)
594
549
  end
data/psych.gemspec CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "psych"
5
- s.version = "2.2.4"
5
+ s.version = "3.0.0.beta2"
6
6
  s.authors = ["Aaron Patterson", "SHIBATA Hiroshi", "Charles Oliver Nutter"]
7
7
  s.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org", "headius@headius.com"]
8
- s.date = "2016-11-14"
8
+ s.date = "2017-06-16"
9
9
  s.summary = "Psych is a YAML parser and emitter"
10
10
  s.description = <<-DESCRIPTION
11
11
  Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
@@ -17,7 +17,7 @@ DESCRIPTION
17
17
  s.require_paths = ["lib"]
18
18
 
19
19
  # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
- s.files = [".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console", "bin/setup", "ext/psych/.gitignore", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "psych.gemspec"]
20
+ s.files = [".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console", "bin/setup", "ext/psych/.gitignore", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "psych.gemspec"]
21
21
 
22
22
  s.rdoc_options = ["--main", "README.md"]
23
23
  s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 3.0.0.beta2
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-11-14 00:00:00.000000000 Z
13
+ date: 2017-06-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,6 @@ files:
126
126
  - lib/psych/class_loader.rb
127
127
  - lib/psych/coder.rb
128
128
  - lib/psych/core_ext.rb
129
- - lib/psych/deprecated.rb
130
129
  - lib/psych/exception.rb
131
130
  - lib/psych/handler.rb
132
131
  - lib/psych/handlers/document_stream.rb
@@ -185,9 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
184
  requirements:
186
185
  - jar org.yaml:snakeyaml, 1.18
187
186
  rubyforge_project:
188
- rubygems_version: 2.6.8
187
+ rubygems_version: 2.6.11
189
188
  signing_key:
190
189
  specification_version: 4
191
190
  summary: Psych is a YAML parser and emitter
192
191
  test_files: []
193
- has_rdoc:
@@ -1,86 +0,0 @@
1
- # frozen_string_literal: false
2
- require 'date'
3
-
4
- module Psych
5
- DEPRECATED = __FILE__ # :nodoc:
6
-
7
- module DeprecatedMethods # :nodoc:
8
- attr_accessor :taguri
9
- attr_accessor :to_yaml_style
10
- end
11
-
12
- def self.quick_emit thing, opts = {}, &block # :nodoc:
13
- warn "#{caller[0]}: YAML.quick_emit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__))
14
- target = eval 'self', block.binding
15
- target.extend DeprecatedMethods
16
- metaclass = class << target; self; end
17
- metaclass.send(:define_method, :encode_with) do |coder|
18
- target.taguri = coder.tag
19
- target.to_yaml_style = coder.style
20
- block.call coder
21
- end
22
- target.psych_to_yaml unless opts[:nodump]
23
- end
24
-
25
- # This method is deprecated, use Psych.load_stream instead.
26
- def self.load_documents yaml, &block
27
- if $VERBOSE
28
- warn "#{caller[0]}: load_documents is deprecated, use load_stream"
29
- end
30
- list = load_stream yaml
31
- return list unless block_given?
32
- list.each(&block)
33
- end
34
-
35
- def self.detect_implicit thing
36
- warn "#{caller[0]}: detect_implicit is deprecated" if $VERBOSE
37
- return '' unless String === thing
38
- return 'null' if '' == thing
39
- ss = ScalarScanner.new(ClassLoader.new)
40
- ss.tokenize(thing).class.name.downcase
41
- end
42
-
43
- def self.add_ruby_type type_tag, &block
44
- warn "#{caller[0]}: add_ruby_type is deprecated, use add_domain_type" if $VERBOSE
45
- domain = 'ruby.yaml.org,2002'
46
- key = ['tag', domain, type_tag].join ':'
47
- @domain_types[key] = [key, block]
48
- end
49
-
50
- def self.add_private_type type_tag, &block
51
- warn "#{caller[0]}: add_private_type is deprecated, use add_domain_type" if $VERBOSE
52
- domain = 'x-private'
53
- key = [domain, type_tag].join ':'
54
- @domain_types[key] = [key, block]
55
- end
56
-
57
- def self.tagurize thing
58
- warn "#{caller[0]}: add_private_type is deprecated, use add_domain_type" if $VERBOSE
59
- return thing unless String === thing
60
- "tag:yaml.org,2002:#{thing}"
61
- end
62
-
63
- def self.read_type_class type, reference
64
- warn "#{caller[0]}: read_type_class is deprecated" if $VERBOSE
65
- _, _, type, name = type.split ':', 4
66
-
67
- reference = name.split('::').inject(reference) do |k,n|
68
- k.const_get(n.to_sym)
69
- end if name
70
- [type, reference]
71
- end
72
-
73
- def self.object_maker klass, hash
74
- warn "#{caller[0]}: object_maker is deprecated" if $VERBOSE
75
- klass.allocate.tap do |obj|
76
- hash.each { |k,v| obj.instance_variable_set(:"@#{k}", v) }
77
- end
78
- end
79
- end
80
-
81
- class Object
82
- undef :to_yaml_properties rescue nil
83
- def to_yaml_properties # :nodoc:
84
- instance_variables
85
- end
86
- end