Class: WordCountAnalyzer::Counter

Inherits:
Object
  • Object
show all
Defined in:
lib/word_count_analyzer/counter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#backslashObject (readonly)

Returns the value of attribute backslash.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def backslash
  @backslash
end

#contractionObject (readonly)

Returns the value of attribute contraction.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def contraction
  @contraction
end

#dashed_lineObject (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

#dateObject (readonly)

Returns the value of attribute date.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def date
  @date
end

#dotted_lineObject (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

#ellipsisObject (readonly)

Returns the value of attribute ellipsis.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def ellipsis
  @ellipsis
end

#equal_signObject (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_slashObject (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

Returns the value of attribute hyperlink.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def hyperlink
  @hyperlink
end

#hyphenated_wordObject (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

#numberObject (readonly)

Returns the value of attribute number.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def number
  @number
end

#numbered_listObject (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_punctuationObject (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

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def text
  @text
end

#underscoreObject (readonly)

Returns the value of attribute underscore.



3
4
5
# File 'lib/word_count_analyzer/counter.rb', line 3

def underscore
  @underscore
end

#xhtmlObject (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

#countObject



23
24
25
# File 'lib/word_count_analyzer/counter.rb', line 23

def count
  word_count
end

#mword_countObject



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_countObject



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