Module: EntryInterfaceShim

Included in:
ActiveYoutube
Defined in:
lib/simple_youtube/entry_interface_shim.rb

Overview

This module provides the interface for a response object to have a #entry method regardless of the response object being a single entry or a collection of entries

Instance Method Summary collapse

Instance Method Details

#entryObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/simple_youtube/entry_interface_shim.rb', line 7

def entry
  if attributes.has_key?('entry')
    if attributes['entry'].kind_of? Array
      return attributes['entry']
    else
      return [attributes['entry']]
    end
  else
    [self]
  end
end