Module: Lich::Util::TextStripper::Mode

Defined in:
documented/util/textstripper.rb

Constant Summary collapse

HTML =

Strip HTML tags Constant representing the HTML stripping mode

:html
XML =

Strip XML tags Constant representing the XML stripping mode

:xml
MARKUP =

Strip Markdown/markup formatting Constant representing the MARKUP stripping mode

:markup
MARKDOWN =

Alias for MARKUP (both :markup and :markdown are accepted) Alias for MARKUP, representing the MARKDOWN stripping mode

:markdown
ALL =

Array of all available stripping modes

[HTML, XML, MARKUP, MARKDOWN].freeze

Class Method Summary collapse

Class Method Details

.listString

Returns a comma-separated list of all valid modes

Examples:

Listing modes

Lich::Util::TextStripper.list # => "html, xml, markup, markdown"

Returns:

  • (String)

    A string listing all valid modes



63
64
65
# File 'documented/util/textstripper.rb', line 63

def self.list
  ALL.join(', ')
end

.valid?(mode) ⇒ Boolean

Checks if the given mode is valid

Examples:

Validating a mode

Lich::Util::TextStripper.valid?(:html) # => true

Parameters:

  • mode (Symbol, String)

    The mode to validate

Returns:

  • (Boolean)

    True if the mode is valid, false otherwise



55
56
57
# File 'documented/util/textstripper.rb', line 55

def self.valid?(mode)
  ALL.include?(mode.to_sym)
end