Class: StyleScanner::Problems::Base
- Inherits:
-
Object
- Object
- StyleScanner::Problems::Base
- Defined in:
- lib/style_scanner/problems/base.rb
Instance Attribute Summary collapse
-
#offending_text ⇒ Object
readonly
Returns the value of attribute offending_text.
-
#sentence ⇒ Object
readonly
Returns the value of attribute sentence.
Instance Method Summary collapse
-
#initialize(sentence, offending_text) ⇒ Base
constructor
A new instance of Base.
- #on_text?(problematic_word) ⇒ Boolean
- #user_friendly_readout ⇒ Object
Constructor Details
#initialize(sentence, offending_text) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/style_scanner/problems/base.rb', line 7 def initialize(sentence, offending_text) @sentence = sentence @offending_text = offending_text end |
Instance Attribute Details
#offending_text ⇒ Object (readonly)
Returns the value of attribute offending_text.
5 6 7 |
# File 'lib/style_scanner/problems/base.rb', line 5 def offending_text @offending_text end |
#sentence ⇒ Object (readonly)
Returns the value of attribute sentence.
5 6 7 |
# File 'lib/style_scanner/problems/base.rb', line 5 def sentence @sentence end |
Instance Method Details
#on_text?(problematic_word) ⇒ Boolean
12 13 14 |
# File 'lib/style_scanner/problems/base.rb', line 12 def on_text?(problematic_word) offending_text.strip_punctuation == problematic_word.strip_punctuation end |
#user_friendly_readout ⇒ Object
16 17 18 |
# File 'lib/style_scanner/problems/base.rb', line 16 def user_friendly_readout [problem_name.red,sentence.text.green,offending_text.yellow].join(" | ") end |