Class: Stringprep::Table::In
Instance Method Summary collapse
- #include?(code) ⇒ Boolean
-
#initialize(data) ⇒ In
constructor
A new instance of In.
Methods inherited from Base
Constructor Details
Instance Method Details
#include?(code) ⇒ Boolean
10 11 12 13 14 15 16 17 18 |
# File 'lib/stringprep/table/in.rb', line 10 def include?(code) if code.is_a?(String) unpacked = code.unpack('U*') raise ArgumentError, 'Only one character is allowed' unless unpacked.length == 1 code = unpacked[0] end return unless code.class < Integer @code_list.any? { |x| (x.is_a?(Range)) ? x.include?(code) : x == code } end |