Class: PrelandsRails::CreateSimpleSource::ValidateZipContent::ValidateHtml::Html
- Inherits:
-
Object
- Object
- PrelandsRails::CreateSimpleSource::ValidateZipContent::ValidateHtml::Html
- Defined in:
- lib/prelands_rails/create_simple_source/validate_zip_content/validate_html/html.rb
Overview
Принимает строку с html разметкой и валидирует её.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(string, continue_id) ⇒ Html
constructor
A new instance of Html.
- #valid? ⇒ Boolean
Constructor Details
#initialize(string, continue_id) ⇒ Html
Returns a new instance of Html.
14 15 16 17 18 |
# File 'lib/prelands_rails/create_simple_source/validate_zip_content/validate_html/html.rb', line 14 def initialize(string, continue_id) @errors = [] @continue_id = continue_id @string = string.gsub(/(\r\n?|\n)/, '') # убираем переносы, мешающие регуляркам end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
11 12 13 |
# File 'lib/prelands_rails/create_simple_source/validate_zip_content/validate_html/html.rb', line 11 def errors @errors end |
Instance Method Details
#valid? ⇒ Boolean
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/prelands_rails/create_simple_source/validate_zip_content/validate_html/html.rb', line 20 def valid? @errors = [ check_internal_scripts, check_internal_styles, check_continue_element, check_js_plug, check_css_plug, check_title_presence, check_a_hrefs, check_favicon ].compact !@errors.any? end |