Class: Hawaiian

Inherits:
Object
  • Object
show all
Defined in:
lib/hawaiian.rb

Constant Summary collapse

@@character_substitutions =
{
  "ʻ" => "‘",
  "ā" => "ā",
  "ē" => "ē",
  "ī" => "ī",
  "ō" => "ō",
  "ū" => "ū",
  "Ā" => "Ā",
  "Ē" => "Ē",
  "Ī" => "Ī",
  "Ō" => "Ō",
  "Ū" => "Ū",
  "" => "ō",
  "" => "ā",
  "" => "Ō",
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHawaiian

Returns a new instance of Hawaiian.



19
20
# File 'lib/hawaiian.rb', line 19

def initialize
end

Class Method Details

.encode_html(text) ⇒ Object



29
30
31
32
33
34
# File 'lib/hawaiian.rb', line 29

def self.encode_html( text )
  @@character_substitutions.each do |haw,code|
    text.gsub!(haw,code)
  end
  text
end

.hawaiian?(text) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
# File 'lib/hawaiian.rb', line 22

def self.hawaiian?( text )
  @@character_substitutions.each do |haw,code|
    return true if text.include?( haw )
  end
  return false
end