From 144054558ff849b204eefc57d30c00e182270660 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 8 Oct 2010 23:37:31 -0700 Subject: More abstraction. --- omptagger | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/omptagger b/omptagger index 205717b..3d33675 100755 --- a/omptagger +++ b/omptagger @@ -24,16 +24,31 @@ class Metadata def output(tag, val, spacing = 2) puts ' ' + tag + ' ' * spacing + val end -end -class VorbisComment < Metadata + private :output + def view puts ' Viewing tags:' if @tags.empty? puts ' No tags set.' - return + return true end + end + + def viewtag(tag) + puts ' Viewing ' + tag + ' tag:' + + unless @tags.has_key? tag + puts ' Tag not set.' + return true + end + end +end + +class VorbisComment < Metadata + def view + return if super @tags.sort.each do |tag, val| val.each do |val| @@ -43,12 +58,7 @@ class VorbisComment < Metadata end def viewtag(tag) - puts ' Viewing ' + tag + ' tag:' - - unless @tags.has_key? tag - puts ' Tag not set.' - return - end + return if super @tags[tag].each do |val| output(tag, val) -- cgit v1.2.3-70-g09d2