From 9874650e4b803831984ecb1df04ab06ec33f900c Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Fri, 18 Dec 2009 23:53:43 -0600 Subject: [PATCH] Silence Some Stupid Warnings in Ruby 1.9 --- lib/chunks/chunk.rb | 2 +- lib/chunks/wiki.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/chunks/chunk.rb b/lib/chunks/chunk.rb index 9b32d55f..c1a8e2ac 100644 --- a/lib/chunks/chunk.rb +++ b/lib/chunks/chunk.rb @@ -11,7 +11,7 @@ module Chunk # Rails's default utf-8 support causes problems here. So, for Chunk::Abstract class, turn off # multibyte character support. - $KCODE = 'n' + $KCODE = 'n' unless ''.respond_to?(:force_encoding) # automatically construct the array of derivatives of Chunk::Abstract @derivatives = [] diff --git a/lib/chunks/wiki.rb b/lib/chunks/wiki.rb index e7d5ddaa..16821489 100644 --- a/lib/chunks/wiki.rb +++ b/lib/chunks/wiki.rb @@ -71,7 +71,9 @@ module WikiChunk attr_reader :escaped_text unless defined? WIKI_WORD - WIKI_WORD = Regexp.new('(":)?(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0, 'u') + WIKI_WORD = ''.respond_to?(:force_encoding) ? + Regexp.new('(":)?(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0) : + Regexp.new('(":)?(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0, 'u') end def self.pattern