diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 10:58:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 10:58:01 -0700 |
commit | 803653a94027596864d8776e64807906fd44bb68 (patch) | |
tree | 5ae1e412b9061c967276624521f867df94d1b78f /lib/psych | |
parent | 0c82d6d009eceb2bac048c2262f68c1fc494dde9 (diff) | |
download | psych-803653a94027596864d8776e64807906fd44bb68.tar.gz |
* 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
Diffstat (limited to 'lib/psych')
-rw-r--r-- | lib/psych/exception.rb | 7 | ||||
-rw-r--r-- | lib/psych/syntax_error.rb | 7 | ||||
-rw-r--r-- | lib/psych/visitors/to_ruby.rb | 1 |
3 files changed, 11 insertions, 4 deletions
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 |