Class: ODDB::FiPDF::FachinfoWrapper
- Defined in:
- ext/fipdf/src/fachinfo_wrapper.rb,
ext/fipdf/test/fachinfo_wrapper_test.rb
Instance Attribute Summary collapse
-
#wrapper_class ⇒ Object
writeonly
Sets the attribute wrapper_class.
Instance Method Summary collapse
- #each_chapter(&block) ⇒ Object
- #first_chapter ⇒ Object
-
#initialize(fachinfo) ⇒ FachinfoWrapper
constructor
A new instance of FachinfoWrapper.
- #name ⇒ Object
- #need_new_page?(height, width, formats) ⇒ Boolean
Constructor Details
#initialize(fachinfo) ⇒ FachinfoWrapper
Returns a new instance of FachinfoWrapper.
10 11 12 13 14 |
# File 'ext/fipdf/src/fachinfo_wrapper.rb', line 10 def initialize(fachinfo) @wrapper_class = ChapterWrapper @fachinfo = fachinfo super end |
Instance Attribute Details
#wrapper_class=(value) ⇒ Object (writeonly)
Sets the attribute wrapper_class
13 14 15 |
# File 'ext/fipdf/test/fachinfo_wrapper_test.rb', line 13 def wrapper_class=(value) @wrapper_class = value end |
Instance Method Details
#each_chapter(&block) ⇒ Object
15 16 17 18 19 |
# File 'ext/fipdf/src/fachinfo_wrapper.rb', line 15 def each_chapter(&block) @fachinfo.each_chapter { |chapter| block.call(@wrapper_class.new(chapter)) } end |
#first_chapter ⇒ Object
32 33 34 |
# File 'ext/fipdf/src/fachinfo_wrapper.rb', line 32 def first_chapter @wrapper_class.new(@fachinfo.first_chapter) end |
#name ⇒ Object
29 30 31 |
# File 'ext/fipdf/src/fachinfo_wrapper.rb', line 29 def name "<b>" + @fachinfo.name + "</b>" end |
#need_new_page?(height, width, formats) ⇒ Boolean
20 21 22 23 24 25 26 27 28 |
# File 'ext/fipdf/src/fachinfo_wrapper.rb', line 20 def need_new_page?(height, width, formats) fmt_dname = formats[:drug_name] fmt_cname = formats[:company_name] height_dname = fmt_dname.get_height(name, width) + fmt_dname.margin height_cname = fmt_cname.get_height(@fachinfo.company_name, width) height = height - (height_dname + height_cname) (height <= 0) \ || first_chapter.need_new_page?(height, width, formats) end |