Class: PDFRavager::Fields::Checkbox

Inherits:
Object
  • Object
show all
Includes:
PDFRavager::FieldTypes::AcroForm, PDFRavager::FieldTypes::XFA
Defined in:
lib/pdf_ravager/fields/checkbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PDFRavager::FieldTypes::XFA

#set_xfa_value, #xfa_name

Methods included from PDFRavager::FieldTypes::AcroForm

#acro_form_name, #set_acro_form_value

Constructor Details

#initialize(name, value, opts = {}) ⇒ Checkbox



12
13
14
15
16
# File 'lib/pdf_ravager/fields/checkbox.rb', line 12

def initialize(name, value, opts={})
  @name, @value = name, value
  @true_value = opts[:true_value] ? opts[:true_value] : '1'
  @false_value = opts[:false_value] ? opts[:false_value] : '0'
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/pdf_ravager/fields/checkbox.rb', line 10

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/pdf_ravager/fields/checkbox.rb', line 10

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/pdf_ravager/fields/checkbox.rb', line 18

def ==(other)
  self.name == other.name && self.value == other.value
end

#acro_form_valueObject



30
31
32
# File 'lib/pdf_ravager/fields/checkbox.rb', line 30

def acro_form_value
  @value ? @true_value : @false_value
end

#xfa_node_typeObject



22
23
24
# File 'lib/pdf_ravager/fields/checkbox.rb', line 22

def xfa_node_type
  'integer'
end

#xfa_valueObject



26
27
28
# File 'lib/pdf_ravager/fields/checkbox.rb', line 26

def xfa_value
  @value ? @true_value : @false_value
end