Sha256: a669b7aacc890f6e9a26273ac9b922f99dc81fb5658e529aea0ee9a8ce406b82

Contents?: true

Size: 365 Bytes

Versions: 2

Compression:

Stored size: 365 Bytes

Contents

class TextUtils::FormatQualifier < TextUtils::Processor
  def call data, env
    env[:format] = (
      (data =~ /\A\s*<[a-z_\-0-9]+>.*<\/[a-z_\-0-9]+>\s*\z/im) or
      (data =~ /\A\s*<[a-z_\-0-9]+\/>\s*\z/i)
    ) ? :html : :markdown

    data = call_next data, env

    raise "some processor in pipe clear the data format!" unless env[:format]
    data
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rad_kit-0.0.10 lib/text_utils/format_qualifier.rb
rad_kit-0.0.9 lib/text_utils/format_qualifier.rb