Skip to content

Commit

Permalink
Initialize tags as array and allow to set it as single value.
Browse files Browse the repository at this point in the history
  • Loading branch information
janfri committed Apr 27, 2015
1 parent 9d45ea7 commit 097cfa8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/multi_exiftool/reader.rb
Expand Up @@ -15,6 +15,7 @@ class Reader

def initialize
super
@tags = []
end

def self.mandatory_args
Expand Down Expand Up @@ -50,6 +51,10 @@ def exiftool_args

alias read execute # :nodoc:

def tags= value
@tags = Array(value)
end

private

def tags_args
Expand Down
13 changes: 13 additions & 0 deletions test/test_reader.rb
Expand Up @@ -9,6 +9,19 @@ class TestReader < Test::Unit::TestCase
@reader = MultiExiftool::Reader.new
end

context 'tags' do

test 'tags are initialized as array' do
assert_equal [], @reader.tags
end

test 'tags could be set as single value' do
@reader.tags = 'fnumber'
assert_equal ['fnumber'], @reader.tags
end

end

context 'exiftool_args method' do

test 'simple case' do
Expand Down

0 comments on commit 097cfa8

Please sign in to comment.