Module: BaseAttributes
- Extended by:
- ClassMethods
- Included in:
- PDFGen::BaseRegion
- Defined in:
- lib/modules/base_attributes.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#border_bottom ⇒ Object
Returns the value of attribute border_bottom.
-
#border_color ⇒ Object
Returns the value of attribute border_color.
-
#border_left ⇒ Object
Returns the value of attribute border_left.
-
#border_right ⇒ Object
Returns the value of attribute border_right.
-
#border_style ⇒ Object
Returns the value of attribute border_style.
-
#border_top ⇒ Object
Returns the value of attribute border_top.
-
#border_width ⇒ Object
Returns the value of attribute border_width.
- #height ⇒ Object
-
#is_breakable ⇒ Object
writeonly
Sets the attribute is_breakable.
-
#pad_bottom ⇒ Object
readonly
Returns the value of attribute pad_bottom.
-
#pad_left ⇒ Object
readonly
Returns the value of attribute pad_left.
-
#pad_right ⇒ Object
readonly
Returns the value of attribute pad_right.
-
#pad_top ⇒ Object
readonly
Returns the value of attribute pad_top.
-
#page_pad_top ⇒ Object
padding from the page top after page break.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
- #av_width ⇒ Object
- #border=(value) ⇒ Object
- #border_params ⇒ Object
- #breakable? ⇒ Boolean
- #paddings=(value) ⇒ Object
- #var_init ⇒ Object
Methods included from ClassMethods
Instance Attribute Details
#background_color ⇒ Object
Returns the value of attribute background_color.
24 25 26 |
# File 'lib/modules/base_attributes.rb', line 24 def background_color @background_color end |
#border_bottom ⇒ Object
Returns the value of attribute border_bottom.
63 64 65 |
# File 'lib/modules/base_attributes.rb', line 63 def border_bottom @border_bottom end |
#border_color ⇒ Object
Returns the value of attribute border_color.
63 64 65 |
# File 'lib/modules/base_attributes.rb', line 63 def border_color @border_color end |
#border_left ⇒ Object
Returns the value of attribute border_left.
63 64 65 |
# File 'lib/modules/base_attributes.rb', line 63 def border_left @border_left end |
#border_right ⇒ Object
Returns the value of attribute border_right.
63 64 65 |
# File 'lib/modules/base_attributes.rb', line 63 def border_right @border_right end |
#border_style ⇒ Object
Returns the value of attribute border_style.
63 64 65 |
# File 'lib/modules/base_attributes.rb', line 63 def border_style @border_style end |
#border_top ⇒ Object
Returns the value of attribute border_top.
63 64 65 |
# File 'lib/modules/base_attributes.rb', line 63 def border_top @border_top end |
#border_width ⇒ Object
Returns the value of attribute border_width.
63 64 65 |
# File 'lib/modules/base_attributes.rb', line 63 def border_width @border_width end |
#height ⇒ Object
54 55 56 |
# File 'lib/modules/base_attributes.rb', line 54 def height [minimal_height, @height].max end |
#is_breakable=(value) ⇒ Object (writeonly)
Sets the attribute is_breakable
52 53 54 |
# File 'lib/modules/base_attributes.rb', line 52 def is_breakable=(value) @is_breakable = value end |
#pad_bottom ⇒ Object (readonly)
Returns the value of attribute pad_bottom.
71 72 73 |
# File 'lib/modules/base_attributes.rb', line 71 def pad_bottom @pad_bottom end |
#pad_left ⇒ Object (readonly)
Returns the value of attribute pad_left.
71 72 73 |
# File 'lib/modules/base_attributes.rb', line 71 def pad_left @pad_left end |
#pad_right ⇒ Object (readonly)
Returns the value of attribute pad_right.
71 72 73 |
# File 'lib/modules/base_attributes.rb', line 71 def pad_right @pad_right end |
#pad_top ⇒ Object (readonly)
Returns the value of attribute pad_top.
71 72 73 |
# File 'lib/modules/base_attributes.rb', line 71 def pad_top @pad_top end |
#page_pad_top ⇒ Object
padding from the page top after page break
59 60 61 |
# File 'lib/modules/base_attributes.rb', line 59 def page_pad_top @page_pad_top end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
61 62 63 |
# File 'lib/modules/base_attributes.rb', line 61 def width @width end |
Class Method Details
.included(base) ⇒ Object
20 21 22 |
# File 'lib/modules/base_attributes.rb', line 20 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#av_width ⇒ Object
82 83 84 |
# File 'lib/modules/base_attributes.rb', line 82 def av_width width - pad_left - pad_right end |
#border=(value) ⇒ Object
66 67 68 69 |
# File 'lib/modules/base_attributes.rb', line 66 def border= value self.border_top = self.border_bottom = self.border_left = self.border_right = value end |
#border_params ⇒ Object
77 78 79 80 |
# File 'lib/modules/base_attributes.rb', line 77 def border_params border_type = {:solid => [1, 0], :dotted => [1, 1], :none => [0, 1]} PDF::Writer::StrokeStyle.new(@border_width, :dash => {:pattern => border_type[@border_style]}) end |
#breakable? ⇒ Boolean
48 49 50 |
# File 'lib/modules/base_attributes.rb', line 48 def breakable? @is_breakable end |
#paddings=(value) ⇒ Object
73 74 75 |
# File 'lib/modules/base_attributes.rb', line 73 def paddings=(value) @pad_bottom = @pad_left = @pad_right = @pad_top = value end |
#var_init ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/modules/base_attributes.rb', line 26 def var_init @width = 0 #document.pdf.page_width - document.pdf.left_margin - document.pdf.right_margin @height = 0 @pad_top = 0 @pad_bottom = 0 @pad_left = 0 @pad_right = 0 @border_top = false @border_left = false @border_right = false @border_bottom = false @border_style = :solid @border_width = 1 @border_color = Color::RGB::Black @is_breakable = false @background_color = nil end |