Module: CorpPdf::Fields::Base
- Includes:
- Actions::Base
- Defined in:
- lib/corp_pdf/fields/base.rb
Overview
Base class for field types with shared functionality
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#field_type ⇒ Object
readonly
Returns the value of attribute field_type.
-
#field_value ⇒ Object
readonly
Returns the value of attribute field_value.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #height ⇒ Object
- #initialize(document, name, options = {}) ⇒ Object
- #page_num ⇒ Object
- #width ⇒ Object
- #x ⇒ Object
- #y ⇒ Object
Methods included from Actions::Base
#acroform_ref, #apply_patch, #find_page_by_number, #get_object_body_with_patch, #next_fresh_object_number, #patches, #resolver
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
9 10 11 |
# File 'lib/corp_pdf/fields/base.rb', line 9 def document @document end |
#field_type ⇒ Object (readonly)
Returns the value of attribute field_type.
9 10 11 |
# File 'lib/corp_pdf/fields/base.rb', line 9 def field_type @field_type end |
#field_value ⇒ Object (readonly)
Returns the value of attribute field_value.
9 10 11 |
# File 'lib/corp_pdf/fields/base.rb', line 9 def field_value @field_value end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
9 10 11 |
# File 'lib/corp_pdf/fields/base.rb', line 9 def end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/corp_pdf/fields/base.rb', line 9 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/corp_pdf/fields/base.rb', line 9 def end |
Instance Method Details
#height ⇒ Object
32 33 34 |
# File 'lib/corp_pdf/fields/base.rb', line 32 def height [:height] || 20 end |
#initialize(document, name, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/corp_pdf/fields/base.rb', line 11 def initialize(document, name, = {}) @document = document @name = name = normalize_hash_keys() = normalize_hash_keys([:metadata] || {}) @field_type = determine_field_type @field_value = [:value] || "" end |
#page_num ⇒ Object
36 37 38 |
# File 'lib/corp_pdf/fields/base.rb', line 36 def page_num [:page] || 1 end |
#width ⇒ Object
28 29 30 |
# File 'lib/corp_pdf/fields/base.rb', line 28 def width [:width] || 100 end |
#x ⇒ Object
20 21 22 |
# File 'lib/corp_pdf/fields/base.rb', line 20 def x [:x] || 100 end |
#y ⇒ Object
24 25 26 |
# File 'lib/corp_pdf/fields/base.rb', line 24 def y [:y] || 500 end |