Class: Pageflow::ZencoderAttachment
- Inherits:
-
Object
- Object
- Pageflow::ZencoderAttachment
- Defined in:
- app/models/pageflow/zencoder_attachment.rb
Constant Summary collapse
- PATH =
"/:zencoder_asset_version/:host/:class/:id_partition/:filename"
- URL =
":zencoder_protocol://:zencoder_host_alias#{PATH}"
- HLS_URL =
":zencoder_protocol://:zencoder_hls_host_alias#{PATH}"
- HLS_ORIGIN_URL =
":zencoder_protocol://:zencoder_hls_origin_host_alias#{PATH}"
Instance Attribute Summary collapse
-
#file_name_pattern ⇒ Object
readonly
Returns the value of attribute file_name_pattern.
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#styles ⇒ Object
readonly
Returns the value of attribute styles.
Instance Method Summary collapse
- #base_name_pattern ⇒ Object
- #dir_name ⇒ Object
- #format ⇒ Object
-
#initialize(instance, file_name_pattern, options = {}) ⇒ ZencoderAttachment
constructor
A new instance of ZencoderAttachment.
- #original_filename ⇒ Object
- #path ⇒ Object
- #url(url_options = {}) ⇒ Object
Constructor Details
#initialize(instance, file_name_pattern, options = {}) ⇒ ZencoderAttachment
Returns a new instance of ZencoderAttachment.
10 11 12 13 14 15 16 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 10 def initialize(instance, file_name_pattern, = {}) @instance = instance @file_name_pattern = file_name_pattern @options = @styles = {} end |
Instance Attribute Details
#file_name_pattern ⇒ Object (readonly)
Returns the value of attribute file_name_pattern.
8 9 10 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 8 def file_name_pattern @file_name_pattern end |
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
8 9 10 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 8 def instance @instance end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 8 def @options end |
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
8 9 10 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 8 def styles @styles end |
Instance Method Details
#base_name_pattern ⇒ Object
26 27 28 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 26 def base_name_pattern File.basename(file_name_pattern) end |
#dir_name ⇒ Object
22 23 24 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 22 def dir_name File.dirname(path) end |
#format ⇒ Object
18 19 20 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 18 def format [:format] end |
#original_filename ⇒ Object
30 31 32 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 30 def original_filename [file_name_pattern.gsub('{{number}}', '0'), [:format]].compact * '.' end |
#path ⇒ Object
34 35 36 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 34 def path Paperclip::Interpolations.interpolate(PATH, self, 'default') end |
#url(url_options = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/pageflow/zencoder_attachment.rb', line 38 def url( = {}) base_url = case ([:host] || [:host]) when :hls HLS_URL when :hls_origin HLS_ORIGIN_URL else URL end Paperclip::Interpolations.interpolate(base_url + suffix(), self, 'default') end |