Sha256: c29d9d2192dfcc38d76f58237c350005a72181b0ecc606a0960bfa59c33b1ba4
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
class Gimei::Address attr_reader :prefecture, :city, :town def initialize @prefecture = Prefecture.new @city = City.new @town = Town.new end def kanji "#{prefecture.kanji}#{city.kanji}#{town.kanji}" end def hiragana "#{prefecture.hiragana}#{city.hiragana}#{town.hiragana}" end def katakana "#{prefecture.katakana}#{city.katakana}#{town.katakana}" end def romaji "#{prefecture.romaji} #{city.romaji} #{town.romaji}" end alias_method :to_s, :kanji class Prefecture def kanji @prefectures[0] end def hiragana @prefectures[1] end def katakana @prefectures[2] end def romaji Romaji.kana2romaji(hiragana).capitalize end def initialize @prefectures = Gimei::ADDRESSES['addresses']['prefecture'].sample end alias_method :to_s, :kanji end class City def kanji @cities[0] end def hiragana @cities[1] end def katakana @cities[2] end def romaji Romaji.kana2romaji(hiragana).capitalize end def initialize @cities = Gimei::ADDRESSES['addresses']['city'].sample end alias_method :to_s, :kanji end class Town def kanji @towns[0] end def hiragana @towns[1] end def katakana @towns[2] end def romaji Romaji.kana2romaji(hiragana).capitalize end def initialize @towns = Gimei::ADDRESSES['addresses']['town'].sample end alias_method :to_s, :kanji end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gimei-0.4.0 | lib/gimei/address.rb |
gimei-0.3.0 | lib/gimei/address.rb |