Class: DynamicPDFApi::LineElement
- Defined in:
- lib/ruby_client/Elements/LineElement.rb
Overview
Represents a line page element.
This class can be used to place lines of different length, width, color and patterns on a page.
Instance Attribute Summary collapse
-
#color ⇒ Object
Gets or sets the Color object to use for the line.
-
#line_style ⇒ Object
Gets or sets the LineStyle object to use for the style of the line.
-
#width ⇒ Object
Gets or sets the width of the line.
-
#x2_offset ⇒ Object
Gets or sets the X2 coordinate of the line.
-
#y2_offset ⇒ Object
Gets or sets the Y2 coordinate of the line.
Attributes inherited from Element
#_input_value, #_resource, #_text_font, #_type, #even_pages, #odd_pages, #placement, #x_offset, #y_offset
Instance Method Summary collapse
-
#initialize(x2_offset, y2_offset, placement = ElementPlacement::TOP_LEFT) ⇒ LineElement
constructor
Initializes a new instance of the LineElement class.
- #to_json(_options = {}) ⇒ Object
Constructor Details
#initialize(x2_offset, y2_offset, placement = ElementPlacement::TOP_LEFT) ⇒ LineElement
Initializes a new instance of the LineElement class.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_client/Elements/LineElement.rb', line 19 def initialize(x2_offset, y2_offset, placement = ElementPlacement::TOP_LEFT) super() @color = nil @width = nil @line_style = nil @_type = ElementType::LINE @placement = placement @x2_offset = x2_offset @y2_offset = y2_offset end |
Instance Attribute Details
#color ⇒ Object
Gets or sets the Color object to use for the line.
34 35 36 |
# File 'lib/ruby_client/Elements/LineElement.rb', line 34 def color @color end |
#line_style ⇒ Object
Gets or sets the LineStyle object to use for the style of the line.
54 55 56 |
# File 'lib/ruby_client/Elements/LineElement.rb', line 54 def line_style @line_style end |
#width ⇒ Object
Gets or sets the width of the line.
49 50 51 |
# File 'lib/ruby_client/Elements/LineElement.rb', line 49 def width @width end |
#x2_offset ⇒ Object
Gets or sets the X2 coordinate of the line.
39 40 41 |
# File 'lib/ruby_client/Elements/LineElement.rb', line 39 def x2_offset @x2_offset end |
#y2_offset ⇒ Object
Gets or sets the Y2 coordinate of the line.
44 45 46 |
# File 'lib/ruby_client/Elements/LineElement.rb', line 44 def y2_offset @y2_offset end |
Instance Method Details
#to_json(_options = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ruby_client/Elements/LineElement.rb', line 56 def to_json( = {}) json_array = {} json_array["type"] = "line" json_array["color"] = @color._color_string if !@color.nil? && !@color._color_string.nil? json_array["xOffset"] = @x_offset unless @x_offset.nil? json_array["yOffset"] = @y_offset unless @y_offset.nil? json_array["x2Offset"] = @x2_offset unless @x2_offset.nil? json_array["y2Offset"] = @y2_offset unless @y2_offset.nil? json_array["width"] = @width unless @width.nil? if !@line_style.nil? && !@line_style._line_style_string.nil? json_array["lineStyle"] = @line_style._line_style_string end # --------------------------------- json_array["placement"] = @placement unless @placement.nil? json_array["xOffset"] = @x_offset unless @x_offset.nil? json_array["yOffset"] = @y_offset unless @y_offset.nil? json_array["evenPages"] = @even_pages unless @even_pages.nil? json_array["oddPages"] = @odd_pages unless @odd_pages.nil? JSON.pretty_generate(json_array) end |