Class: ContentType::Parser

Inherits:
Parslet::Parser
  • Object
show all
Defined in:
lib/content_type/parser.rb

Overview

ContentType string parser

Defined Under Namespace

Classes: CharList

Constant Summary collapse

CHAR =

rubocop:disable LineLength rubocop:disable Blocks rubocop:disable BlockAlignment

CharList.new { (0..127).to_a.map(&:chr) }
CTLS =
CharList.new { (0..31).to_a.map(&:chr) << 127.chr }
CR =
CharList.new { [13.chr] }
LF =
CharList.new { [10.chr] }
SPACE =
CharList.new { [" "] }
HTAB =
CharList.new { [9.chr] }
CRLF =
CharList.new { [13.chr + 10.chr] }
SPECIALS =
CharList.new { ["(", ")", "<", ">", "@", ",", ";", ":", "\\", "\"", ".", "[", "]"] }
TSPECIALS =
CharList.new { SPECIALS + ["/", "?", "="] }

Instance Method Summary collapse

Instance Method Details

#stri(s) ⇒ Object



40
41
42
# File 'lib/content_type/parser.rb', line 40

def stri(s)
  s.split(//).map { |c| match["#{c.upcase}#{c.downcase}"] }.reduce :>>
end