1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Document Haml::Util#check_encoding.

This commit is contained in:
Nathan Weizenbaum 2009-11-24 21:48:55 -08:00
parent e73bd9f19c
commit d569632b63

View file

@ -186,6 +186,14 @@ module Haml
Haml::Util::RUBY_VERSION[0] == 1 && Haml::Util::RUBY_VERSION[1] < 9
end
# Checks that the encoding of a string is valid in Ruby 1.9.
# If it's not, yields an error string describing the invalid character
# and the line on which it occurrs.
#
# @param str [String] The string of which to check the encoding
# @yield [msg] A block in which an encoding error can be raised.
# Only yields if there is an encoding error
# @yieldparam msg [String] The error message to be raised
def check_encoding(str)
return if ruby1_8?
return if str.valid_encoding?