# eric4.Helpviewer.AdBlock.AdBlockRule

Module implementing the AdBlock rule class.

### Global Attributes

None

### Classes

AdBlockRule | Class implementing the AdBlock rule.

### Functions

None

## AdBlockRule

Class implementing the AdBlock rule.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

AdBlockRule | Constructor
__convertPatternToRegExp | Private method to convert a wildcard pattern to a regular expression.
filter | Public method to get the rule filter string.
isCSSRule | Public method to check, if the rule is a CSS rule.
isEnabled | Public method to check, if the rule is enabled.
isException | Public method to check, if the rule defines an exception.
networkMatch | Public method to check the rule for a match.
regExpPattern | Public method to get the regexp pattern of the rule.
setEnabled | Public method to set the rule's enabled state.
setException | Public method to set the rule's exception flag.
setFilter | Public method to set the rule filter string.
setPattern | Public method to set the rule pattern.

### Static Methods

None

#### AdBlockRule (Constructor)

AdBlockRule(filter = QString())

Constructor

#### AdBlockRule.__convertPatternToRegExp

__convertPatternToRegExp(wildcardPattern)

Private method to convert a wildcard pattern to a regular expression.

wildcardPattern
  string containing the wildcard pattern (string or QString)

Returns:
  string containing a regular expression (QString)

#### AdBlockRule.filter

filter()

Public method to get the rule filter string.

Returns:
  rule filter string (QString)

#### AdBlockRule.isCSSRule

isCSSRule()

Public method to check, if the rule is a CSS rule.

Returns:
  flag indicating a CSS rule (boolean)

#### AdBlockRule.isEnabled

isEnabled()

Public method to check, if the rule is enabled.

Returns:
  flag indicating enabled state (boolean)

#### AdBlockRule.isException

isException()

Public method to check, if the rule defines an exception.

Returns:
  flag indicating an exception (boolean)

#### AdBlockRule.networkMatch

networkMatch(encodedUrl)

Public method to check the rule for a match.

encodedUrl
  string encoded URL to be checked (string or QString)

Returns:
  flag indicating a match (boolean)

#### AdBlockRule.regExpPattern

regExpPattern()

Public method to get the regexp pattern of the rule.

Returns:
  regexp pattern (QRegExp)

#### AdBlockRule.setEnabled

setEnabled(enabled)

Public method to set the rule's enabled state.

enabled
  flag indicating the new enabled state (boolean)

#### AdBlockRule.setException

setException(exception)

Public method to set the rule's exception flag.

exception
  flag indicating an exception rule (boolean)

#### AdBlockRule.setFilter

setFilter(filter)

Public method to set the rule filter string.

filter
  rule filter string (string or QString)

#### AdBlockRule.setPattern

setPattern(pattern, isRegExp)

Public method to set the rule pattern.

pattern
  string containing the pattern (string or QString)
isRegExp
  flag indicating a reg exp pattern (boolean)

Up