Module: Utils::Parser

Included in:
Mp3::Album, Mp3::Disc, Mp3::Renamer, Mp3::Track
Defined in:
lib/utils/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse_args(name, args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/utils/parser.rb', line 9

def parse_args(name, args)
    if args.class.name == 'Array'
        parse_array(name, args)
    elsif args.class.name == 'Hash'
        parse_hash(name, args)
    elsif args.class.name == 'String'
        parse_string(name, args)
    else
        parse_string(name, args.to_s)
    end
end

#parse_array(name, args) ⇒ Object



21
22
23
24
# File 'lib/utils/parser.rb', line 21

def parse_array(name, args)
    puts "mixin: parse_array(args)" if $DEBUG
    args.each { |a| parse_args(name, a) }
end

#parse_hash(name, args) ⇒ Object



26
27
28
29
# File 'lib/utils/parser.rb', line 26

def parse_hash(name, args)
    puts "mixin: parse_hash(args)" if $DEBUG
    args.keys.each { |k| parse_args(k, args[k]) }
end

#parse_string(name, value) ⇒ Object



31
32
33
34
# File 'lib/utils/parser.rb', line 31

def parse_string(name, value)
    puts "mixin: parse_string(name, value)" if $DEBUG
    puts "#{name} / #{value}"
end