Class: WordCountAnalyzer::Counter
- Inherits:
-
Object
- Object
- WordCountAnalyzer::Counter
- Defined in:
- lib/word_count_analyzer/counter.rb
Instance Attribute Summary collapse
-
#backslash ⇒ Object
readonly
Returns the value of attribute backslash.
-
#contraction ⇒ Object
readonly
Returns the value of attribute contraction.
-
#dashed_line ⇒ Object
readonly
Returns the value of attribute dashed_line.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#dotted_line ⇒ Object
readonly
Returns the value of attribute dotted_line.
-
#ellipsis ⇒ Object
readonly
Returns the value of attribute ellipsis.
-
#equal_sign ⇒ Object
readonly
Returns the value of attribute equal_sign.
-
#forward_slash ⇒ Object
readonly
Returns the value of attribute forward_slash.
-
#hyperlink ⇒ Object
readonly
Returns the value of attribute hyperlink.
-
#hyphenated_word ⇒ Object
readonly
Returns the value of attribute hyphenated_word.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#numbered_list ⇒ Object
readonly
Returns the value of attribute numbered_list.
-
#stray_punctuation ⇒ Object
readonly
Returns the value of attribute stray_punctuation.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#underscore ⇒ Object
readonly
Returns the value of attribute underscore.
-
#xhtml ⇒ Object
readonly
Returns the value of attribute xhtml.
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(text:, **args) ⇒ Counter
constructor
A new instance of Counter.
- #mword_count ⇒ Object
- #pages_count ⇒ Object
Constructor Details
#initialize(text:, **args) ⇒ Counter
Returns a new instance of Counter.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/word_count_analyzer/counter.rb', line 4 def initialize(text:, **args) @text = text @ellipsis = args[:ellipsis] || 'ignore' @hyperlink = args[:hyperlink] || 'count_as_one' @contraction = args[:contraction] || 'count_as_one' @hyphenated_word = args[:hyphenated_word] || 'count_as_one' @date = args[:date] || 'no_special_treatment' @number = args[:number] || 'count' @numbered_list = args[:numbered_list] || 'count' @xhtml = args[:xhtml] || 'remove' @forward_slash = args[:forward_slash] || 'count_as_multiple_except_dates' @backslash = args[:backslash] || 'count_as_one' @dotted_line = args[:dotted_line] || 'ignore' @dashed_line = args[:dashed_line] || 'ignore' @underscore = args[:underscore] || 'ignore' @stray_punctuation = args[:stray_punctuation] || 'ignore' @equal_sign = 'ignore' end |
Instance Attribute Details
#backslash ⇒ Object (readonly)
Returns the value of attribute backslash.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def backslash @backslash end |
#contraction ⇒ Object (readonly)
Returns the value of attribute contraction.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def contraction @contraction end |
#dashed_line ⇒ Object (readonly)
Returns the value of attribute dashed_line.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def dashed_line @dashed_line end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def date @date end |
#dotted_line ⇒ Object (readonly)
Returns the value of attribute dotted_line.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def dotted_line @dotted_line end |
#ellipsis ⇒ Object (readonly)
Returns the value of attribute ellipsis.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def ellipsis @ellipsis end |
#equal_sign ⇒ Object (readonly)
Returns the value of attribute equal_sign.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def equal_sign @equal_sign end |
#forward_slash ⇒ Object (readonly)
Returns the value of attribute forward_slash.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def forward_slash @forward_slash end |
#hyperlink ⇒ Object (readonly)
Returns the value of attribute hyperlink.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def hyperlink @hyperlink end |
#hyphenated_word ⇒ Object (readonly)
Returns the value of attribute hyphenated_word.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def hyphenated_word @hyphenated_word end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def number @number end |
#numbered_list ⇒ Object (readonly)
Returns the value of attribute numbered_list.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def numbered_list @numbered_list end |
#stray_punctuation ⇒ Object (readonly)
Returns the value of attribute stray_punctuation.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def stray_punctuation @stray_punctuation end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def text @text end |
#underscore ⇒ Object (readonly)
Returns the value of attribute underscore.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def underscore @underscore end |
#xhtml ⇒ Object (readonly)
Returns the value of attribute xhtml.
3 4 5 |
# File 'lib/word_count_analyzer/counter.rb', line 3 def xhtml @xhtml end |
Instance Method Details
#count ⇒ Object
23 24 25 |
# File 'lib/word_count_analyzer/counter.rb', line 23 def count word_count end |
#mword_count ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/word_count_analyzer/counter.rb', line 46 def mword_count @ellipsis = 'no_special_treatment' @hyperlink = 'count_as_one' @contraction = 'count_as_one' @hyphenated_word = 'count_as_one' @date = 'no_special_treatment' @number = 'count' @numbered_list = 'count' @xhtml = 'keep' @forward_slash = 'count_as_one' @backslash = 'count_as_one' @dotted_line = 'count' @dashed_line = 'count' @underscore = 'count' @stray_punctuation = 'count' word_count end |
#pages_count ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/word_count_analyzer/counter.rb', line 27 def pages_count @ellipsis = 'ignore' @hyperlink = 'split_at_period' @contraction = 'count_as_one' @hyphenated_word = 'count_as_multiple' @date = 'no_special_treatment' @number = 'count' @numbered_list = 'ignore' @xhtml = 'keep' @forward_slash = 'count_as_multiple' @backslash = 'count_as_multiple' @dotted_line = 'ignore' @dashed_line = 'ignore' @underscore = 'ignore' @stray_punctuation = 'ignore' @equal_sign = 'break' word_count end |