lib/string-direction/strategies/characters_strategy.rb in string-direction-1.0.0 vs lib/string-direction/strategies/characters_strategy.rb in string-direction-1.1.0
- old
+ new
@@ -20,18 +20,18 @@
end
private
def rtl_characters?(string)
- string.match(/[#{join_scripts_for_regexp(rtl_scripts)}]/) ? true : false
+ string.match(/[#{join_rtl_for_regex}]/)
end
def ltr_characters?(string)
- string.gsub(CHAR_IGNORE_REGEX, '').match(/[^#{join_scripts_for_regexp(rtl_scripts)}]/) ? true : false
+ string.gsub(CHAR_IGNORE_REGEX, '').match(/[^#{join_rtl_for_regex}]/)
end
- def join_scripts_for_regexp(scripts)
- scripts.map { |script| '\p{' + script + '}' }.join
+ def join_rtl_for_regex
+ rtl_scripts.map { |script| '\p{' + script + '}' }.join
end
def rtl_scripts
StringDirection.configuration.rtl_scripts
end