Class: StyleScanner::Problems::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/style_scanner/problems/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_textObject (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

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

Returns:

  • (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_readoutObject



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