Class: Treetop::Runtime::CompiledParser
- Defined in:
- lib/piggly/parser/treetop_ruby19_patch.rb
Overview
Patch CompiledParser to handle UTF-8 strings properly
Instance Method Summary collapse
Instance Method Details
#original_prepare_to_parse ⇒ Object
10 |
# File 'lib/piggly/parser/treetop_ruby19_patch.rb', line 10 alias_method :original_prepare_to_parse, :prepare_to_parse |
#prepare_to_parse(input) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/piggly/parser/treetop_ruby19_patch.rb', line 12 def prepare_to_parse(input) # Ensure input is treated as UTF-8 if input.respond_to?(:force_encoding) && input.encoding != Encoding::UTF_8 input = input.dup.force_encoding('UTF-8') end original_prepare_to_parse(input) end |