Class: PDFShaver::PageSet
- Inherits:
-
Object
- Object
- PDFShaver::PageSet
- Includes:
- Enumerable
- Defined in:
- lib/pdfshaver/page_set.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #[](page_index) ⇒ Object
- #each(&block) ⇒ Object
- #first ⇒ Object
-
#initialize(document, page_list = :all, options = {}) ⇒ PageSet
constructor
A new instance of PageSet.
- #last ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(document, page_list = :all, options = {}) ⇒ PageSet
Returns a new instance of PageSet.
6 7 8 9 |
# File 'lib/pdfshaver/page_set.rb', line 6 def initialize document, page_list=:all, ={} @document = document @page_list = extract_page_numbers(page_list) end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'lib/pdfshaver/page_set.rb', line 5 def document @document end |
Instance Method Details
#[](page_index) ⇒ Object
15 16 17 |
# File 'lib/pdfshaver/page_set.rb', line 15 def [](page_index) Page.new(@document, @page_list.to_a[page_index]) end |
#each(&block) ⇒ Object
11 12 13 |
# File 'lib/pdfshaver/page_set.rb', line 11 def each(&block) enumerator.each(&block) end |
#first ⇒ Object
19 20 21 |
# File 'lib/pdfshaver/page_set.rb', line 19 def first Page.new(@document, @page_list.first) end |
#last ⇒ Object
23 24 25 |
# File 'lib/pdfshaver/page_set.rb', line 23 def last Page.new(@document, @page_list.last) end |
#size ⇒ Object
27 28 29 |
# File 'lib/pdfshaver/page_set.rb', line 27 def size @page_list.size end |