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:
parent
e73bd9f19c
commit
d569632b63
1 changed files with 8 additions and 0 deletions
|
@ -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?
|
||||
|
|
Loading…
Add table
Reference in a new issue