Class: HatenaKeywordHaiku::Word
- Inherits:
-
Object
- Object
- HatenaKeywordHaiku::Word
- Defined in:
- lib/plugins/hatena_keyword_haiku.rb
Instance Method Summary collapse
-
#initialize(word, yomi) ⇒ Word
constructor
A new instance of Word.
- #length ⇒ Object
- #word ⇒ Object
- #yomi ⇒ Object
Constructor Details
#initialize(word, yomi) ⇒ Word
Returns a new instance of Word.
7 8 9 10 11 |
# File 'lib/plugins/hatena_keyword_haiku.rb', line 7 def initialize(word, yomi) raise 'word is nil' unless word and not word.empty? @word = word @yomi = yomi end |
Instance Method Details
#length ⇒ Object
21 22 23 |
# File 'lib/plugins/hatena_keyword_haiku.rb', line 21 def length @length ||= self.yomi.gsub(/\n|ぁ|ぃ|ぅ|ぇ|ぉ|ァ|ィ|ゥ|ェ|ォ|ゃ|ゅ|ょ|ャ|ュ|ョ/, '').split(//).length end |
#word ⇒ Object
13 14 15 |
# File 'lib/plugins/hatena_keyword_haiku.rb', line 13 def word @word end |
#yomi ⇒ Object
17 18 19 |
# File 'lib/plugins/hatena_keyword_haiku.rb', line 17 def yomi @yomi end |