Skip to content

Commit

Permalink
Video#tags should return [] if video has no tags
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiob committed Apr 4, 2017
1 parent b4ff787 commit 878194b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,11 @@ For more information about changelogs, check
[Keep a Changelog](http://keepachangelog.com) and
[Vandamme](http://tech-angels.github.io/vandamme).

## 0.1.1 - 2017-04-04

* [ENHANCEMENT] Add :defaults to `has_attribute`
* [BUGFIX] Video#tags returns `[]` and not `nil` when a video has no tags

## 0.1.0 - 2017-04-03

* [FEATURE] Extracted first classes from Yt
2 changes: 1 addition & 1 deletion lib/yt/core/version.rb
Expand Up @@ -3,6 +3,6 @@ module Yt
module Core
# @return [String] the SemVer-compatible gem version.
# @see http://semver.org
VERSION = '0.1.0'
VERSION = '0.1.1'
end
end
2 changes: 1 addition & 1 deletion lib/yt/resource.rb
Expand Up @@ -52,7 +52,7 @@ def self.has_attribute(name, options = {}, &block)
part = keys.shift
value = @data[part] || fetch_part(part)
keys.each{|key| value = value[camelize key]}
value = type_cast value, options[:type]
value = type_cast (value || options[:default]), options[:type]
block_given? ? instance_exec(value, &block) : value
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/yt/video.rb
Expand Up @@ -34,7 +34,7 @@ class Video < Resource

# @!attribute [r] tags
# @return [Array<String>] the list of tags associated with the video.
has_attribute :tags, in: :snippet
has_attribute :tags, in: :snippet, default: []

# @!attribute [r] category_id
# @return [Integer] the ID of the associated YouTube video category.
Expand Down

0 comments on commit 878194b

Please sign in to comment.