Method: Pdfmdedit#set_tags
- Defined in:
- lib/pdfmd/pdfmdedit.rb
#set_tags(tags = Array.new) ⇒ Object
Setting the tags to edit
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/pdfmd/pdfmdedit.rb', line 36 def ( = Array.new) if .is_a?(String) and .downcase == 'all' .each do |value| [value] = '' end elsif .is_a?(Array) .each do |value| [value] = '' end elsif .is_a?(Hash) # NOTE: might need some adjustment here # Not sure this is used at all = else # Try to match tags if .is_a?(String) = {} = .split(',') .each do |value| if value.match(/:/) self.log('debug', 'Found tag value assignment.') tagmatching = value.split(':') # Check date for validity if tagmatching[0] == 'createdate' validatedDate = validateDate(tagmatching[1]) if !validatedDate self.log('error',"Date not recognized: '#{tagmatching[1]}'.") abort 'Date format not recognized. Abort.' else self.log('debug',"Identified date: #{validatedDate} ") [tagmatching[0]] = validatedDate end else self.log('debug', "Identified key #{tagmatching[0]} with value '#{tagmatching[1]}'.") [tagmatching[0]] = tagmatching[1] end else [value] = '' end end end end end |