diff --git a/demo-site/config.ru b/demo-site/config.ru index 331c05c..2178d59 100644 --- a/demo-site/config.ru +++ b/demo-site/config.ru @@ -1,3 +1,3 @@ -Encoding.default_internal = Encoding.default_external = 'UTF-8' if RUBY_VERSION >= '1.9' +Encoding.default_internal = Encoding.default_external = 'UTF-8' require ::File.expand_path('../forme_demo', __FILE__) run FormeDemo::App.app diff --git a/lib/forme.rb b/lib/forme.rb index 3566c28..cf52237 100644 --- a/lib/forme.rb +++ b/lib/forme.rb @@ -25,16 +25,10 @@ def self.h(value) rescue LoadError ESCAPE_TABLE = {'&' => '&', '<' => '<', '>' => '>', '"' => '"', "'" => '''}.freeze ESCAPE_TABLE.each_value(&:freeze) - if RUBY_VERSION >= '1.9' - # Escape the following characters with their HTML/XML - # equivalents. - def self.h(value) - value.to_s.gsub(/[&<>"']/, ESCAPE_TABLE) - end - else - def self.h(value) - value.to_s.gsub(/[&<>"']/){|s| ESCAPE_TABLE[s]} - end + # Escape the following characters with their HTML/XML + # equivalents. + def self.h(value) + value.to_s.gsub(/[&<>"']/, ESCAPE_TABLE) end end end