Class: Bypass::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/bypass/filter.rb

Direct Known Subclasses

HTMLFilter, TextFilter

Constant Summary collapse

URL_PATTERN =
/\bhttps?:\/\/
[a-zA-Z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+
[a-zA-Z0-9\-_~:\/\?#\[\]@!$&\*\+;=%]/x

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, options = {}) ⇒ Filter

Returns a new instance of Filter.



9
10
11
12
# File 'lib/bypass/filter.rb', line 9

def initialize(content, options = {})
  @content = content.to_s.encode("UTF-8")
  @fragment = options.fetch(:fragment, true)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'lib/bypass/filter.rb', line 3

def content
  @content
end

#fragmentObject (readonly)

Returns the value of attribute fragment.



3
4
5
# File 'lib/bypass/filter.rb', line 3

def fragment
  @fragment
end

Instance Method Details

#replaceObject

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/bypass/filter.rb', line 14

def replace
  raise NotImplementedError
end

#to_sObject



18
19
20
# File 'lib/bypass/filter.rb', line 18

def to_s
  content
end