Module: CharacterSet::RubyFallback::CharacterSetMethods::ClassMethods

Defined in:
lib/character_set/ruby_fallback/character_set_methods.rb

Instance Method Summary collapse

Instance Method Details

#from_ranges(*ranges) ⇒ Object



5
6
7
# File 'lib/character_set/ruby_fallback/character_set_methods.rb', line 5

def from_ranges(*ranges)
  new(Array(ranges).flat_map(&:to_a))
end

#of(string) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
# File 'lib/character_set/ruby_fallback/character_set_methods.rb', line 9

def of(string)
  raise ArgumentError, 'pass a String' unless string.is_a?(String)
  new(string.codepoints)
end