Class: Asciidoctor::Prawn::Extensions::Extent
- Defined in:
- lib/asciidoctor/pdf/ext/prawn/extensions.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#from ⇒ Object
Returns the value of attribute from.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #each_page ⇒ Object
-
#initialize(current_page, current_column, current_cursor, from_page, from_column, from_cursor, to_page, to_cursor) ⇒ Extent
constructor
A new instance of Extent.
- #page_range ⇒ Object
- #single_page? ⇒ Boolean
- #single_page_height ⇒ Object
Constructor Details
#initialize(current_page, current_column, current_cursor, from_page, from_column, from_cursor, to_page, to_cursor) ⇒ Extent
Returns a new instance of Extent.
40 41 42 43 44 45 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 40 def initialize current_page, current_column, current_cursor, from_page, from_column, from_cursor, to_page, to_cursor self.current = Position.new current_page, current_column, current_cursor self.from = Position.new from_page, from_column, from_cursor self.from = current if from == current self.to = Position.new to_page, nil, to_cursor end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current
39 40 41 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 39 def current @current end |
#from ⇒ Object
Returns the value of attribute from
39 40 41 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 39 def from @from end |
#to ⇒ Object
Returns the value of attribute to
39 40 41 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 39 def to @to end |
Instance Method Details
#each_page ⇒ Object
47 48 49 50 51 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 47 def each_page from.page.upto to.page do |pgnum| yield pgnum == from.page && from, pgnum == to.page && to, pgnum end end |
#page_range ⇒ Object
61 62 63 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 61 def page_range (from.page..to.page) end |
#single_page? ⇒ Boolean
53 54 55 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 53 def single_page? from.page == to.page end |
#single_page_height ⇒ Object
57 58 59 |
# File 'lib/asciidoctor/pdf/ext/prawn/extensions.rb', line 57 def single_page_height single_page? ? from.cursor - to.cursor : nil end |