Module: Ion::Stringer

Defined in:
lib/ion/stringer.rb

Class Method Summary collapse

Class Method Details

.classify(name) ⇒ Object



13
14
15
16
# File 'lib/ion/stringer.rb', line 13

def self.classify(name)
  str = name.to_s
  str.scan(/\b(\w)(\w*)/).map { |(w, ord)| w.upcase + ord.downcase }.join('')
end

.keywords(str) ⇒ Object

“Hey, yes you.” => %w(hey yes you)



8
9
10
11
# File 'lib/ion/stringer.rb', line 8

def self.keywords(str)
  return Array.new  unless str.is_a?(String)
  self.sanitize(str).scan(/\w+/)
end

.sanitize(str) ⇒ Object



2
3
4
5
# File 'lib/ion/stringer.rb', line 2

def self.sanitize(str)
  return ''  unless str.is_a?(String)
  str.downcase.force_encoding('UTF-8')
end