From 6c74f258aca075dea41fd13ec06da9b1955da3c6 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 17 Oct 2010 03:07:23 -0700 Subject: Bugfixes. --- omptagger | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'omptagger') diff --git a/omptagger b/omptagger index b526f3a..78f57a8 100755 --- a/omptagger +++ b/omptagger @@ -158,10 +158,12 @@ class MetadataError < RuntimeError case @error when :empty str = 'No fields set.' - when :unset - str = 'Field not set.' when :invalid str = 'Invalid field name.' + when :scheme + str = 'Filename does not match scheme.' + when :unset + str = 'Field not set.' end return str @@ -231,13 +233,13 @@ class Metadata @write = true end - def settag(field, value) + def settag(field, value, padding = 0) field.upcase! raise MetadataError, :invalid unless valid_field?(field) @metadata[field] = [value] - Output.field(field, value) + Output.field(field, value, padding) @write = true end @@ -270,9 +272,7 @@ class Metadata fields = scheme.scan(regexp).flatten values = @filename.chomp(File.extname(@filename)).scan(regexp).flatten - unless fields.length == values.length - raise MetadataError, 'Filename does not match naming scheme.' - end + raise MetadataError, :scheme unless fields.length == values.length fields.collect! do |field| keys[field[1,1]] -- cgit v1.2.3-70-g09d2