Class: Video

Inherits:
Object
  • Object
show all
Defined in:
lib/syndicate/lib/video.rb

Constant Summary collapse

VALID_EXTENSIONS =
['.mp4', '.avi', '.mkv']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Video

Returns a new instance of Video.



20
21
22
23
# File 'lib/syndicate/lib/video.rb', line 20

def initialize(args = {})
  @title = args[:title]
  @path  = args[:path]
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/syndicate/lib/video.rb', line 4

def description
  @description
end

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/syndicate/lib/video.rb', line 4

def path
  @path
end

#thumbnailObject (readonly)

Returns the value of attribute thumbnail.



4
5
6
# File 'lib/syndicate/lib/video.rb', line 4

def thumbnail
  @thumbnail
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/syndicate/lib/video.rb', line 4

def title
  @title
end

Class Method Details

.from_path(path) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/syndicate/lib/video.rb', line 8

def self.from_path(path)
  if valid_extension? path    
    title = path.split('/').last
    title = strip_extension(title)
  
    Video.new(
      title: title,
      path:  path
    )
  end  
end