class WordCountAnalyzer::HyphenatedWord
Constants
- DASHED_LINE_REGEX
Rubular: rubular.com/r/RjZ7qi0uFf
Attributes
token[R]
Public Class Methods
new(token:)
click to toggle source
# File lib/word_count_analyzer/hyphenated_word.rb, line 7 def initialize(token:) @token = token.gsub(DASHED_LINE_REGEX, '') end
Public Instance Methods
count_as_multiple()
click to toggle source
# File lib/word_count_analyzer/hyphenated_word.rb, line 15 def count_as_multiple token.split(/[﹘,-]/).length end
hyphenated_word?()
click to toggle source
# File lib/word_count_analyzer/hyphenated_word.rb, line 11 def hyphenated_word? (token.include?('-') || token.include?('﹘')) && !WordCountAnalyzer::Hyperlink.new.hyperlink?(token) end
replace()
click to toggle source
# File lib/word_count_analyzer/hyphenated_word.rb, line 19 def replace token.split(/[﹘,-]/).join(' ') end