Class: Plex::Movie

Inherits:
Object
  • Object
show all
Defined in:
lib/plex-ruby/movie.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section, key) ⇒ Movie

Returns a new instance of Movie.

Parameters:

  • section (Section)

    this movie belongs in

  • key (String)

    to later referance this Movie



8
9
10
11
# File 'lib/plex-ruby/movie.rb', line 8

def initialize(section, key)
  @section = section
  @key = key
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Delegates all method calls to the video object that represents this movie, if that video object responds to the method.



20
21
22
23
24
25
26
# File 'lib/plex-ruby/movie.rb', line 20

def method_missing(method, *args, &block)
  if video.respond_to? method
    video.send(method, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/plex-ruby/movie.rb', line 4

def key
  @key
end

#sectionObject (readonly)

Returns the value of attribute section.



4
5
6
# File 'lib/plex-ruby/movie.rb', line 4

def section
  @section
end

Instance Method Details

#attribute_hashObject

Returns the attribute hash that represents this Movie



14
15
16
# File 'lib/plex-ruby/movie.rb', line 14

def attribute_hash
  video.attribute_hash.merge({'key' => key})
end

#inspectObject



42
43
44
# File 'lib/plex-ruby/movie.rb', line 42

def inspect #:nodoc:
  "#<Plex::Movie: key=\"#{key}\" title=\"#{title}\">"
end

#methodsObject



32
33
34
# File 'lib/plex-ruby/movie.rb', line 32

def methods
  (super + video.methods).uniq
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/plex-ruby/movie.rb', line 28

def respond_to?(method)
  super || video.respond_to?(method)
end

#urlObject



37
38
39
# File 'lib/plex-ruby/movie.rb', line 37

def url #:nodoc:
  section.url
end