Module: Clickwrap::ReviewedText
- Defined in:
- lib/clickwrap/reviewed_text.rb
Overview
Detects scaffolding language that must never be mistaken for a reviewed operational reason. This deliberately does not reject the lowercase word "todo": it is an ordinary Spanish word. It catches conventional developer markers and generated English placeholders instead.
Constant Summary collapse
- PLACEHOLDER_PATTERNS =
[ /\A(?:TODO|TBD|FIXME)(?:\b|:)/, /replace (?:this|with|me)/i, /your reviewed (?:purpose|reason|decision)/i, /placeholder/i, /\A\.{3}\z/ ].freeze
Class Method Summary collapse
Class Method Details
.placeholder?(value) ⇒ Boolean
19 20 21 22 |
# File 'lib/clickwrap/reviewed_text.rb', line 19 def placeholder?(value) text = value.to_s.strip text.present? && PLACEHOLDER_PATTERNS.any? { |pattern| pattern.match?(text) } end |
.present_and_reviewed?(value) ⇒ Boolean
24 25 26 |
# File 'lib/clickwrap/reviewed_text.rb', line 24 def present_and_reviewed?(value) value.to_s.strip.present? && !placeholder?(value) end |