Module: Ilovepdf::Signature::FileElement::InstanceMethods
- Defined in:
- lib/ilovepdf/signature/file_element.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#size ⇒ Object
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
9 10 11 |
# File 'lib/ilovepdf/signature/file_element.rb', line 9 def content @content end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
9 10 11 |
# File 'lib/ilovepdf/signature/file_element.rb', line 9 def file @file end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
9 10 11 |
# File 'lib/ilovepdf/signature/file_element.rb', line 9 def info @info end |
#pages ⇒ Object
Returns the value of attribute pages.
9 10 11 |
# File 'lib/ilovepdf/signature/file_element.rb', line 9 def pages @pages end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
9 10 11 |
# File 'lib/ilovepdf/signature/file_element.rb', line 9 def position @position end |
#size ⇒ Object
Returns the value of attribute size.
9 10 11 |
# File 'lib/ilovepdf/signature/file_element.rb', line 9 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/ilovepdf/signature/file_element.rb', line 9 def type @type end |
Instance Method Details
#initialize(file) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/ilovepdf/signature/file_element.rb', line 10 def initialize(file) raise ::Ilovepdf::Errors::ArgumentError.new("Only Ilovepdf::File type of object is allowed") unless file.class.name == "Ilovepdf::File" @file = file @position = "0 0" @pages = "1" @size = 40 end |
#set_position(x: 0, y: 0) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ilovepdf/signature/file_element.rb', line 18 def set_position(x: 0,y: 0) raise ::Ilovepdf::Errors::ArgumentError.new("x must be an integer or float") unless x.is_a?(Integer) || x.is_a?(Float) raise ::Ilovepdf::Errors::ArgumentError.new("y must be an integer or float") unless y.is_a?(Integer) || y.is_a?(Float) @position = "#{x.abs} #{-y.abs}" position end |
#to_h ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ilovepdf/signature/file_element.rb', line 35 def to_h { position: position, pages: pages, size: size, info: info, type: type, content: content } end |