Sha256: cf7d96009bcc38b6c9638fa73a9efb23703ea1b3a71fe394a8c7fc94933e6ce8

Contents?: true

Size: 779 Bytes

Versions: 4

Compression:

Stored size: 779 Bytes

Contents

require 'pdf_ravager/field_types/acro_form'
require 'pdf_ravager/field_types/xfa'

module PDFRavager
  module Fields
    class Checkbox
      include FieldTypes::AcroForm
      include FieldTypes::XFA

      attr_reader :name, :value

      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

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

      def xfa_node_type
        'integer'
      end

      def xfa_value
        @value ? @true_value : @false_value
      end

      def acro_form_value
        @value ? @true_value : @false_value
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pdf_ravager-0.2.2 lib/pdf_ravager/fields/checkbox.rb
pdf_ravager-0.2.1 lib/pdf_ravager/fields/checkbox.rb
pdf_ravager-0.2.0 lib/pdf_ravager/fields/checkbox.rb
pdf_ravager-0.1.0 lib/pdf_ravager/fields/checkbox.rb