From 803653a94027596864d8776e64807906fd44bb68 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 5 Apr 2013 10:58:01 -0700 Subject: * ext/psych/lib/psych/exception.rb: there should be only one exception base class. Fixes tenderlove/psych #125 * ext/psych/lib/psych.rb: require the correct exception class * ext/psych/lib/psych/syntax_error.rb: ditto * ext/psych/lib/psych/visitors/to_ruby.rb: ditto fixes #125 --- CHANGELOG.rdoc | 8 ++++++++ lib/psych.rb | 6 ------ lib/psych/exception.rb | 7 +++++++ lib/psych/syntax_error.rb | 7 +++---- lib/psych/visitors/to_ruby.rb | 1 + 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 lib/psych/exception.rb diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index 2df0bb5..c1c3a09 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,11 @@ +Sat Apr 6 02:54:08 2013 Aaron Patterson + + * ext/psych/lib/psych/exception.rb: there should be only one exception + base class. Fixes tenderlove/psych #125 + * ext/psych/lib/psych.rb: require the correct exception class + * ext/psych/lib/psych/syntax_error.rb: ditto + * ext/psych/lib/psych/visitors/to_ruby.rb: ditto + Sat Apr 6 02:06:04 2013 Aaron Patterson * ext/psych/lib/psych/visitors/to_ruby.rb: correctly register diff --git a/lib/psych.rb b/lib/psych.rb index 3ca6117..7d7d2bf 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -221,12 +221,6 @@ module Psych # The version of libyaml Psych is using LIBYAML_VERSION = Psych.libyaml_version.join '.' - class Exception < RuntimeError - end - - class BadAlias < Exception - end - ### # Load +yaml+ in to a Ruby data structure. If multiple documents are # provided, the object contained in the first document will be returned. diff --git a/lib/psych/exception.rb b/lib/psych/exception.rb new file mode 100644 index 0000000..d96c527 --- /dev/null +++ b/lib/psych/exception.rb @@ -0,0 +1,7 @@ +module Psych + class Exception < RuntimeError + end + + class BadAlias < Exception + end +end diff --git a/lib/psych/syntax_error.rb b/lib/psych/syntax_error.rb index f972256..e200ef0 100644 --- a/lib/psych/syntax_error.rb +++ b/lib/psych/syntax_error.rb @@ -1,8 +1,7 @@ -module Psych - class Error < RuntimeError - end +require 'psych/exception' - class SyntaxError < Error +module Psych + class SyntaxError < Psych::Exception attr_reader :file, :line, :column, :offset, :problem, :context def initialize file, line, col, offset, problem, context diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb index b59bc38..75c7bc0 100644 --- a/lib/psych/visitors/to_ruby.rb +++ b/lib/psych/visitors/to_ruby.rb @@ -1,4 +1,5 @@ require 'psych/scalar_scanner' +require 'psych/exception' unless defined?(Regexp::NOENCODING) Regexp::NOENCODING = 32 -- cgit v1.2.3