Class: Blog::ContentRules::Rule

Inherits:
Data
  • Object
show all
Defined in:
app/services/blog/content_rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#applies_toObject (readonly)

Returns the value of attribute applies_to

Returns:

  • (Object)

    the current value of applies_to



30
31
32
# File 'app/services/blog/content_rules.rb', line 30

def applies_to
  @applies_to
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



30
31
32
# File 'app/services/blog/content_rules.rb', line 30

def name
  @name
end

#validateObject (readonly)

Returns the value of attribute validate

Returns:

  • (Object)

    the current value of validate



30
31
32
# File 'app/services/blog/content_rules.rb', line 30

def validate
  @validate
end

Instance Method Details

#call(html) ⇒ Object



31
32
33
34
# File 'app/services/blog/content_rules.rb', line 31

def call(html)
  violations = Array(validate.call(html)).compact
  violations.map { |msg| { rule: name, message: msg.to_s } }
end