Class: PdfExtract::AbstractView
- Inherits:
-
Object
- Object
- PdfExtract::AbstractView
- Defined in:
- lib/view/abstract_view.rb
Constant Summary collapse
- @@auto_colors =
["ff0000", "00ff00", "0000ff", "ffff00", "ff7f00", "ffc0cb", "800080", "f0e68c", "a52a2a"]
Instance Method Summary collapse
- #auto_color ⇒ Object
-
#initialize(pdf, filename) ⇒ AbstractView
constructor
A new instance of AbstractView.
-
#objects ⇒ Object
Return renderable objects - those whose spatials method was called explicitly.
- #singular_name(name) ⇒ Object
Constructor Details
#initialize(pdf, filename) ⇒ AbstractView
Returns a new instance of AbstractView.
8 9 10 11 |
# File 'lib/view/abstract_view.rb', line 8 def initialize pdf, filename @pdf = pdf @filename = filename end |
Instance Method Details
#auto_color ⇒ Object
19 20 21 22 23 24 |
# File 'lib/view/abstract_view.rb', line 19 def auto_color @next_auto_color = 0 if @next_auto_color.nil? color = @@auto_colors[@next_auto_color] @next_auto_color = @next_auto_color.next color end |
#objects ⇒ Object
Return renderable objects - those whose spatials method was called explicitly.
15 16 17 |
# File 'lib/view/abstract_view.rb', line 15 def objects @pdf.spatial_objects.reject { |type, _| not @pdf.explicit_call? type } end |
#singular_name(name) ⇒ Object
26 27 28 29 |
# File 'lib/view/abstract_view.rb', line 26 def singular_name name name = name.sub /ies$/, 'y' name = name.sub /s$/, '' end |