Class: NameCheckerStrategy
- Inherits:
-
GeneralStrategy
- Object
- GeneralStrategy
- NameCheckerStrategy
- Defined in:
- lib/burnspam/point_tracker.rb
Overview
A specialized strategy for analizing the name field. Analysis for name usually requires much less processing than comment body.
- Version
-
0.1.1
- Date
-
2011/12/18
- @author
-
Brian Burns, x10205284
- @reference
Instance Method Summary collapse
-
#count_urls ⇒ Object
We only expect to count one or zero URLs in name.
-
#duplicate? ⇒ Boolean
This method is not used but must be included to interface correctly with the Checker class.
-
#initialize(name) ⇒ NameCheckerStrategy
constructor
Stores name as a string and value in array.
-
#length ⇒ Object
Check length of name.
-
#starts_with? ⇒ Boolean
This method is not used but must be included to interface correctly with the Checker class.
-
#url_length ⇒ Object
Check length if URL exists.
Methods inherited from GeneralStrategy
Constructor Details
#initialize(name) ⇒ NameCheckerStrategy
Stores name as a string and value in array
177 178 179 180 |
# File 'lib/burnspam/point_tracker.rb', line 177 def initialize(name) @name = name @keywords = [name] end |
Instance Method Details
#count_urls ⇒ Object
We only expect to count one or zero URLs in name
183 184 185 |
# File 'lib/burnspam/point_tracker.rb', line 183 def count_urls @name.include?('http://') ? 1 : 0 end |
#duplicate? ⇒ Boolean
This method is not used but must be included to interface correctly with the Checker class
205 206 207 |
# File 'lib/burnspam/point_tracker.rb', line 205 def duplicate? false end |
#length ⇒ Object
Check length of name
193 194 195 |
# File 'lib/burnspam/point_tracker.rb', line 193 def length @name.length end |
#starts_with? ⇒ Boolean
This method is not used but must be included to interface correctly with the Checker class
199 200 201 |
# File 'lib/burnspam/point_tracker.rb', line 199 def starts_with? false end |
#url_length ⇒ Object
Check length if URL exists
188 189 190 |
# File 'lib/burnspam/point_tracker.rb', line 188 def url_length count_urls ? @name.length : 0 end |