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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

common_setter

Instance Attribute Details

#background_colorObject

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_bottomObject

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_colorObject

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_leftObject

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_rightObject

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_styleObject

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_topObject

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_widthObject

Returns the value of attribute border_width.



63
64
65
# File 'lib/modules/base_attributes.rb', line 63

def border_width
  @border_width
end

#heightObject



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

Parameters:

  • value

    the value to set the attribute is_breakable to.



52
53
54
# File 'lib/modules/base_attributes.rb', line 52

def is_breakable=(value)
  @is_breakable = value
end

#pad_bottomObject (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_leftObject (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_rightObject (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_topObject (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_topObject

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

#widthObject (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_widthObject



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_paramsObject



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

Returns:

  • (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_initObject



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