Skip to content
Browse files

Version bump to 0.5.0

  • Loading branch information...
1 parent 1624b33 commit 2f150240aac748a368fbbda71ac7932b3555bba0 @joeellis committed Jan 16, 2012
Showing with 50 additions and 47 deletions.
  1. +2 −8 Gemfile
  2. +13 −14 Gemfile.lock
  3. +19 −4 README.rdoc
  4. +1 −1 VERSION
  5. +15 −20 lib/romajinizer.rb
View
10 Gemfile
@@ -1,13 +1,7 @@
source "http://rubygems.org"
-# Add dependencies required to use your gem here.
-# Example:
-# gem "activesupport", ">= 2.3.5"
-# Add dependencies to develop your gem here.
-# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "rspec", "~> 2.3.0"
- gem "bundler", "~> 1.0.0"
- gem "jeweler", "~> 1.5.2"
+ gem "rspec", "2.8.0"
+ gem "jeweler", "1.6.4"
gem "rcov", ">= 0"
end
View
27 Gemfile.lock
@@ -1,28 +1,27 @@
GEM
remote: http://rubygems.org/
specs:
- diff-lcs (1.1.2)
+ diff-lcs (1.1.3)
git (1.2.5)
- jeweler (1.5.2)
- bundler (~> 1.0.0)
+ jeweler (1.6.4)
+ bundler (~> 1.0)
git (>= 1.2.5)
rake
- rake (0.8.7)
+ rake (0.9.2.2)
rcov (0.9.9)
- rspec (2.3.0)
- rspec-core (~> 2.3.0)
- rspec-expectations (~> 2.3.0)
- rspec-mocks (~> 2.3.0)
- rspec-core (2.3.1)
- rspec-expectations (2.3.0)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.3.0)
+ rspec-mocks (2.8.0)
PLATFORMS
ruby
DEPENDENCIES
- bundler (~> 1.0.0)
- jeweler (~> 1.5.2)
+ jeweler (= 1.6.4)
rcov
- rspec (~> 2.3.0)
+ rspec (= 2.8.0)
View
23 README.rdoc
@@ -1,8 +1,22 @@
-= romajinizer
+Romajinizer
+=====
-Description goes here.
+A gem for helping you convert between Japanese hiragana, katakana, and Roman romaji alphabets. Please note that this gem is not used for converting kanji (libraries such as MeCab would be much more beneficial)
-== Contributing to romajinizer
+Usage
+=====
+
+### Getting Started
+
+ gem install romajinizer
+
+### Examples
+
+ Check out romajinizer_spec.rb under the spec/ folder for clear examples on how to best use this library.
+
+
+Contributing to romajinizer
+=====
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
@@ -12,7 +26,8 @@ Description goes here.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
-== Copyright
+Copyright
+=====
Copyright (c) 2011 Joe Ellis. See LICENSE.txt for
further details.
View
2 VERSION
@@ -1 +1 @@
-0.4.0
+0.5.0
View
35 lib/romajinizer.rb
@@ -1,7 +1,7 @@
# coding: utf-8
#
-# kana2rom.rb
+# to_romaji.rb
# A Ruby module for converting between hiragana, katakana and romaji.
#
# ---------------------------------------------------------------------------------
@@ -24,13 +24,13 @@
# USAGE
#
-# Include kana2rom
+# Include Kana2rom
#
-# kana2rom(str) かな --> ロ-マ字 変換 / hira/katakana ->> romaji conv
-# rom2kata(str) ロ-マ字 --> 片仮名 変換 / romaji --> katakana conv
-# rom2hira(str) ロ-マ字 --> 平仮名 変換 / romaji --> hiragana conv
-# hira2kata(str) 平仮名 --> 片仮名 変換 / hiragana --> katakana conv
-# kata2hira(str) 片仮名 --> 平仮名 変換 / katakana ->> hiragana conv
+# to_romaji(str) かな --> ロ-マ字 変換 / hira/katakana ->> romaji conv
+# to_katakana(str) ロ-マ字 --> 片仮名 変換 / romaji --> katakana conv
+# to_hiragana(str) ロ-マ字 --> 平仮名 変換 / romaji --> hiragana conv
+# hira_to_kata(str) 平仮名 --> 片仮名 変換 / hiragana --> katakana conv
+# kata_to_hira(str) 片仮名 --> 平仮名 変換 / katakana ->> hiragana conv
# kana2kana(str) attempts either to either, returns unique strings only
#
# ---------------------------------------------------------------------------------
@@ -189,7 +189,7 @@ module Kana2rom
Hira2kataH={}; Kata2hiraH.each_pair{|k,v| Hira2kataH[v]=k}; Hira2kataH[""]=""; Hira2kataH[""]=""
- def kana2rom
+ def to_romaji
s=""
self.each_char do |c|
if (Kana2romH.key?(c))
@@ -245,7 +245,7 @@ def kana2rom
return s
end
- def rom2kata
+ def to_katakana
## THIS LINE DOES NOT WORK IN RECENT RUBY VERSIONS!!! r=""; w=[]; chars=str.split(//e)
result=""
word_buffer=[]
@@ -312,13 +312,13 @@ def rom2kata
end
end
- def kata2hira(str)
+ def kata_to_hira(str)
s=""; str.each_char{|c| s+=( Kata2hiraH.key?(c) ? Kata2hiraH[c] : c )}
s.normalize_double_n!
return s
end
- def hira2kata(str)
+ def hira_to_kata(str)
s=""; str.each_char{|c|if(Hira2kataH.key?(c))then s+=Hira2kataH[c];else s+=c; end}
return s
end
@@ -335,16 +335,16 @@ def normalize_double_n!
# Added by Paul 2009-05-12 22:31
def kana2kana(str1)
result = []
- str2 = Kana2rom::hira2kata(str1)
- str3 = Kana2rom::kata2hira(str1)
+ str2 = Kana2rom::hira_to_kata(str1)
+ str3 = Kana2rom::kata_to_hira(str1)
result << str1
result << str2 if str2.length > 0 and str1 !=str2
result << str3 if str3.length > 0 and str2 !=str3 and str3 != str1
return result
end
- def rom2hira
- return kata2hira(rom2kata)
+ def to_hiragana
+ return kata_to_hira(to_katakana)
end
def is_kana?
@@ -378,11 +378,6 @@ def contains_kana?
end
return false
end
-
- alias :to_hiragana :rom2hira
- alias :to_katakana :rom2kata
- alias :to_romaji :kana2rom
-
end
class String

0 comments on commit 2f15024

Please sign in to comment.
Something went wrong with that request. Please try again.