Permalink
Browse files

Add Transliterator.transliterate helper method

  • Loading branch information...
1 parent 4e13a50 commit 24daa5c1d35d107f885852d6dd28473fb4c05ef9 @tomeric tomeric committed Apr 6, 2012
Showing with 18 additions and 0 deletions.
  1. +4 −0 lib/transliterator.rb
  2. +14 −0 spec/transliterator_spec.rb
@@ -7,4 +7,8 @@ module Transliterator
autoload :Latin, 'transliterator/latin'
autoload :Text, 'transliterator/text'
+
+ def self.transliterate(input)
+ Text.new(input).transliterate
+ end
end
@@ -0,0 +1,14 @@
+# encoding: utf-8
+
+require 'spec_helper'
+
+describe Transliterator do
+ describe '#transliterate' do
+ it 'transliterates the given text' do
+ input = "cuī dōnō lĕpĭdūm nŏvūm lĭbēllŭm"
+ output = "cui dono lepidum novum libellum"
+
+ Transliterator.transliterate(input).should == output
+ end
+ end
+end

0 comments on commit 24daa5c

Please sign in to comment.