Class: Preprocessor::Video::Default

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/preprocessor/video.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#absolute?, #absolutize

Constructor Details

#initialize(options) ⇒ Default

Returns a new instance of Default.



35
36
37
38
# File 'lib/preprocessor/video.rb', line 35

def initialize(options)
  self.src = options[:src]
  self.poster = options[:poster]
end

Instance Attribute Details

#posterObject

Returns the value of attribute poster.



30
31
32
# File 'lib/preprocessor/video.rb', line 30

def poster
  @poster
end

#srcObject

Returns the value of attribute src.



30
31
32
# File 'lib/preprocessor/video.rb', line 30

def src
  @src
end

Instance Method Details

#tagObject



40
41
42
43
44
45
46
# File 'lib/preprocessor/video.rb', line 40

def tag
  src = absolutize(self.src, ::Preprocessor::Video.options[:default_path])
  poster = self.poster && %{poster="#{self.poster}"}

  # eventually should use http://camendesign.com/code/video_for_everybody
  %{<video controls #{poster}><source src="#{src}.ogv" type="video/ogg" /><source src="#{src}.mp4" type="video/mp4" /></video>}
end