Class: PdfForms::Field
- Inherits:
-
Object
- Object
- PdfForms::Field
- Defined in:
- lib/pdf_forms/field.rb
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
Common Fields.
-
#justification ⇒ Object
readonly
Common Fields.
-
#name ⇒ Object
readonly
Common Fields.
-
#options ⇒ Object
readonly
Common Fields.
-
#type ⇒ Object
readonly
Common Fields.
-
#value ⇒ Object
readonly
Common Fields.
-
#valuedefault ⇒ Object
readonly
Common Fields.
Instance Method Summary collapse
-
#initialize(field_description) ⇒ Field
constructor
FieldType: Button FieldName: Sprachoptionen_Inverssuche_Widerspruch FieldFlags: 0 FieldJustification: Left FieldStateOption: Ja FieldStateOption: Off.
Constructor Details
#initialize(field_description) ⇒ Field
FieldType: Button FieldName: Sprachoptionen_Inverssuche_Widerspruch FieldFlags: 0 FieldJustification: Left FieldStateOption: Ja FieldStateOption: Off
Represenation of a PDF Form Field
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pdf_forms/field.rb', line 14 def initialize(field_description) field_description.each_line do |line| case line when /FieldStateOption:\s*(.*?)\s*$/ (@options ||= []) << $1 else key, value = line.chomp.split(':').map(&:strip) var_name = key.gsub(/Field/, '').downcase unless self.respond_to?(var_name) self.class.send(:define_method, var_name.to_sym, Proc.new{ instance_variable_get("@#{var_name}".to_sym) } ) # in case new or unknown fields crop up... end instance_variable_set("@#{key.gsub(/Field/, '').downcase}".to_sym, value) end end end |
Instance Attribute Details
#flags ⇒ Object (readonly)
Common Fields
31 32 33 |
# File 'lib/pdf_forms/field.rb', line 31 def flags @flags end |
#justification ⇒ Object (readonly)
Common Fields
31 32 33 |
# File 'lib/pdf_forms/field.rb', line 31 def justification @justification end |
#name ⇒ Object (readonly)
Common Fields
31 32 33 |
# File 'lib/pdf_forms/field.rb', line 31 def name @name end |
#options ⇒ Object (readonly)
Common Fields
31 32 33 |
# File 'lib/pdf_forms/field.rb', line 31 def @options end |
#type ⇒ Object (readonly)
Common Fields
31 32 33 |
# File 'lib/pdf_forms/field.rb', line 31 def type @type end |
#value ⇒ Object (readonly)
Common Fields
31 32 33 |
# File 'lib/pdf_forms/field.rb', line 31 def value @value end |
#valuedefault ⇒ Object (readonly)
Common Fields
31 32 33 |
# File 'lib/pdf_forms/field.rb', line 31 def valuedefault @valuedefault end |