Class: MarkdownTypographerQuotationMarksValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/validators/markdown_typographer_quotation_marks_validator.rb

Constant Summary collapse

QUOTE_COUNT =
4

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ MarkdownTypographerQuotationMarksValidator

Returns a new instance of MarkdownTypographerQuotationMarksValidator.



6
7
8
# File 'lib/validators/markdown_typographer_quotation_marks_validator.rb', line 6

def initialize(opts = {})
  @opts = opts
end

Instance Method Details

#error_messageObject



14
15
16
# File 'lib/validators/markdown_typographer_quotation_marks_validator.rb', line 14

def error_message
  I18n.t("site_settings.errors.list_value_count", count: QUOTE_COUNT)
end

#valid_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/validators/markdown_typographer_quotation_marks_validator.rb', line 10

def valid_value?(value)
  value.present? && value.split("|").size == QUOTE_COUNT
end