Class: PDF::Core::FilterList
- Inherits:
-
Object
- Object
- PDF::Core::FilterList
- Defined in:
- lib/pdf/core/filter_list.rb
Overview
A representation of a list of filters applied to a stream.
Defined Under Namespace
Classes: NotFilter
Instance Method Summary collapse
-
#<<(filter) ⇒ self
Appends a filter to the list.
-
#decode_params ⇒ Array<[Hash, nil]>
Parameters of filters.
-
#each {|(name, decode_params)| ... } ⇒ Array<Array<(Symbol, [Hash, nil])>>
Iterates over filters.
-
#initialize ⇒ FilterList
constructor
A new instance of FilterList.
-
#inspect ⇒ String
-
#names ⇒ Array<Symbol>
Names of filters in the list.
-
#normalized ⇒ Array<Array<(Symbol, [Hash, nil])>>
(also: #to_a)
A normalized representation of the filter list.
Constructor Details
#initialize ⇒ FilterList
Returns a new instance of FilterList.
Source Code
lib/pdf/core/filter_list.rb, line 25
25 | def initialize |
26 | @list = [] |
27 | end
|
Instance Method Details
#<<(filter) ⇒ self
Appends a filter to the list
Source Code
lib/pdf/core/filter_list.rb, line 34
34 | def <<(filter) |
35 | case filter |
36 | when Symbol |
37 | @list << [filter, nil] |
38 | when ::Hash |
39 | filter.each do |name, params| |
40 | @list << [name, params] |
41 | end
|
42 | else
|
43 | raise NotFilter.new(filter: filter) |
44 | end
|
45 | |
46 | self
|
47 | end
|
#decode_params ⇒ Array<[Hash, nil]>
Parameters of filters
Source Code
lib/pdf/core/filter_list.rb, line 69
69 | def decode_params |
70 | @list.map do |(_, params)| |
71 | params
|
72 | end
|
73 | end
|
#each {|(name, decode_params)| ... } ⇒ Array<Array<(Symbol, [Hash, nil])>>
Iterates over filters
Source Code
lib/pdf/core/filter_list.rb, line 87
87 | def each(&block) |
88 | @list.each(&block) |
89 | end
|
#inspect ⇒ String
Source Code
lib/pdf/core/filter_list.rb, line 76
76 | def inspect |
77 | @list.inspect |
78 | end
|
#names ⇒ Array<Symbol>
Names of filters in the list
Source Code
lib/pdf/core/filter_list.rb, line 60
60 | def names |
61 | @list.map do |(name, _)| |
62 | name
|
63 | end
|
64 | end
|
#normalized ⇒ Array<Array<(Symbol, [Hash, nil])>> Also known as: to_a
A normalized representation of the filter list
Source Code
lib/pdf/core/filter_list.rb, line 52
52 | def normalized |
53 | @list
|
54 | end
|