Class: ContentType::Parser::CharList

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(list = nil) ⇒ CharList

Returns a new instance of CharList.



12
13
14
# File 'lib/content_type/parser.rb', line 12

def initialize(list = nil)
  @list = list || yield
end

Instance Method Details

#+(other) ⇒ Object



20
21
22
# File 'lib/content_type/parser.rb', line 20

def +(other)
  CharList.new @list + other.to_a
end

#-(other) ⇒ Object



16
17
18
# File 'lib/content_type/parser.rb', line 16

def -(other)
  CharList.new @list - other.to_a
end

#sizeObject



34
35
36
# File 'lib/content_type/parser.rb', line 34

def size
  to_s.size
end

#to_aObject Also known as: to_ary



24
25
26
# File 'lib/content_type/parser.rb', line 24

def to_a
  @list.dup
end

#to_sObject Also known as: to_str



29
30
31
# File 'lib/content_type/parser.rb', line 29

def to_s
  @list.join
end