Module: Falcon::Encoder::ClassMethods

Defined in:
lib/falcon/encoder.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/falcon/encoder.rb', line 16

def self.extended(base)
  base.class_eval do
    belongs_to :videoable, :polymorphic => true
    
    attr_accessor :ffmpeg_resolution, :ffmpeg_padding
    
    attr_accessible :name, :profile_name, :source_path
    
    validates_presence_of :name, :profile_name, :source_path
    
    before_validation :set_resolution
    before_destroy :remove_output
    
    scope :with_profile, lambda {|name| where(:profile_name => Falcon::Profile.detect(name).name) }
    scope :with_name, lambda {|name| where(:name => name) }
    scope :processing, where(:status => PROCESSING)
    scope :success, where(:status => SUCCESS)
    scope :failure, where(:status => FAILURE)
  end
end