Commit bfed284d97a5bba34a569e70e655e2f9ae96ea53
1 parent
5cf344eb
Exists in
master
and in
29 other branches
Removing unecessary initialize from presenters
Showing
3 changed files
with
0 additions
and
12 deletions
Show diff stats
app/presenters/generic.rb
1 | # Made to encapsulate any UploadedFile | 1 | # Made to encapsulate any UploadedFile |
2 | class FilePresenter::Generic < FilePresenter | 2 | class FilePresenter::Generic < FilePresenter |
3 | - def initialize(f) | ||
4 | - @file = f | ||
5 | - end | ||
6 | - | ||
7 | # if returns low priority, because it is generic. | 3 | # if returns low priority, because it is generic. |
8 | def self.accepts?(f) | 4 | def self.accepts?(f) |
9 | 1 if f.is_a? UploadedFile | 5 | 1 if f.is_a? UploadedFile |
app/presenters/image.rb
1 | class FilePresenter::Image < FilePresenter | 1 | class FilePresenter::Image < FilePresenter |
2 | - def initialize(f) | ||
3 | - @file = f | ||
4 | - end | ||
5 | - | ||
6 | def self.accepts?(f) | 2 | def self.accepts?(f) |
7 | return nil unless f.respond_to? :image? | 3 | return nil unless f.respond_to? :image? |
8 | f.image? ? 10 : nil | 4 | f.image? ? 10 : nil |
plugins/html5_video/lib/file_presenter/video.rb
1 | class FilePresenter::Video < FilePresenter | 1 | class FilePresenter::Video < FilePresenter |
2 | - def initialize(f) | ||
3 | - @file = f | ||
4 | - end | ||
5 | - | ||
6 | def self.accepts?(f) | 2 | def self.accepts?(f) |
7 | return nil if !f.respond_to?(:content_type) || f.content_type.nil? | 3 | return nil if !f.respond_to?(:content_type) || f.content_type.nil? |
8 | ( f.content_type[0..4] == 'video' ) ? 10 : nil | 4 | ( f.content_type[0..4] == 'video' ) ? 10 : nil |