lib/nicoquery/object_mapper/video_array.rb in nicoquery-0.1.8.7 vs lib/nicoquery/object_mapper/video_array.rb in nicoquery-0.1.8.8

- old
+ new

@@ -91,13 +91,18 @@ def community_id @hash['thread']['community_id'].to_i end def tags - tag_hash = @hash['tags']['tag_info'].instance_of? Array - tag_hash = [ @hash['tags']['tag_info'] ] unless tag_hash.instance_of? Array + tag_obj = @hash['tags']['tag_info'] - tag_hash.each_with_object([]) do |tag, array| + if tag_obj.instance_of? Array + tag_array = tag_obj + else + tag_array = [ tag_obj ] + end + + tag_array.each_with_object([]) do |tag, array| array << { text: tag['tag'] } end end end end