Class: PDFGen::BaseRegion
- Inherits:
-
Object
- Object
- PDFGen::BaseRegion
- Includes:
- BaseAttributes
- Defined in:
- lib/base_region.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes included from BaseAttributes
#background_color, #border_bottom, #border_color, #border_left, #border_right, #border_style, #border_top, #border_width, #height, #is_breakable, #pad_bottom, #pad_left, #pad_right, #pad_top, #page_pad_top, #width
Instance Method Summary collapse
- #check_fit_in_height ⇒ Object
-
#document ⇒ Object
gets region’s document.
-
#initialize(parent) ⇒ BaseRegion
constructor
A new instance of BaseRegion.
-
#minimal_height ⇒ Object
gets minimal height that current caption can be written to.
- #render(pos, av_height, test = false) ⇒ Object
-
#set_properties(props = {}) ⇒ Object
sets region properties specified as array.
- #value(val) ⇒ Object
Methods included from BaseAttributes
#av_width, #border=, #border_params, #breakable?, included, #paddings=, #var_init
Methods included from BaseAttributes::ClassMethods
Constructor Details
#initialize(parent) ⇒ BaseRegion
Returns a new instance of BaseRegion.
8 9 10 11 |
# File 'lib/base_region.rb', line 8 def initialize(parent) self.var_init @parent = parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
13 14 15 |
# File 'lib/base_region.rb', line 13 def parent @parent end |
Instance Method Details
#check_fit_in_height ⇒ Object
82 83 84 85 86 |
# File 'lib/base_region.rb', line 82 def check_fit_in_height if (self.height >= document.pdf.page_height-document.page_pad_top) raise "There is too little space for this region on this page" end end |
#document ⇒ Object
gets region’s document
16 17 18 |
# File 'lib/base_region.rb', line 16 def document parent ? parent.document : self end |
#minimal_height ⇒ Object
gets minimal height that current caption can be written to
21 22 23 |
# File 'lib/base_region.rb', line 21 def minimal_height @minimal_height ||= calculate_minimal_height end |
#render(pos, av_height, test = false) ⇒ Object
76 77 78 79 80 |
# File 'lib/base_region.rb', line 76 def render(pos,av_height, test=false) fill(pos) unless test add_border(pos) unless test [pos,true] end |
#set_properties(props = {}) ⇒ Object
sets region properties specified as array
93 94 95 |
# File 'lib/base_region.rb', line 93 def set_properties(props = {}) props.each_pair {|name, value| self.send("#{name}=", value)} end |
#value(val) ⇒ Object
88 89 90 |
# File 'lib/base_region.rb', line 88 def value val "<!#{val.to_s}!>" end |