Class: CorpPdf::Fields::Radio
- Inherits:
-
Object
- Object
- CorpPdf::Fields::Radio
- Includes:
- Base
- Defined in:
- lib/corp_pdf/fields/radio.rb
Overview
Handles radio button field creation
Instance Attribute Summary collapse
-
#field_obj_num ⇒ Object
readonly
Returns the value of attribute field_obj_num.
Attributes included from Base
#document, #field_type, #field_value, #metadata, #name, #options
Instance Method Summary collapse
Methods included from Base
#height, #initialize, #page_num, #width, #x, #y
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
#field_obj_num ⇒ Object (readonly)
Returns the value of attribute field_obj_num.
9 10 11 |
# File 'lib/corp_pdf/fields/radio.rb', line 9 def field_obj_num @field_obj_num end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/corp_pdf/fields/radio.rb', line 11 def call @field_value = @field_value.to_s.gsub(" ", "") group_id = [:group_id] radio_groups = @document.instance_variable_get(:@radio_groups) parent_ref = radio_groups[group_id] if parent_ref # Subsequent radio button: add widget to existing parent's Kids array (parent_ref) else # First radio button in group: create parent field and first widget (group_id, radio_groups) end true end |