Class: Tenon::ProxyAttachment
- Inherits:
-
Object
- Object
- Tenon::ProxyAttachment
- Defined in:
- lib/tenon/proxy_attachment.rb
Instance Attribute Summary collapse
-
#attachment ⇒ Object
readonly
Returns the value of attribute attachment.
Instance Method Summary collapse
- #display_name ⇒ Object
-
#initialize(attachment, klass, asset_name) ⇒ ProxyAttachment
constructor
A new instance of ProxyAttachment.
- #original_filename ⇒ Object
-
#url(style = :original, *args) ⇒ Object
Prefix with an underscore to use base Asset styles.
Constructor Details
#initialize(attachment, klass, asset_name) ⇒ ProxyAttachment
Returns a new instance of ProxyAttachment.
5 6 7 8 |
# File 'lib/tenon/proxy_attachment.rb', line 5 def initialize(, klass, asset_name) @attachment = .try(:attachment) || @style_prefix = "#{klass.to_s.underscore.gsub('/', '_')}_#{asset_name}" end |
Instance Attribute Details
#attachment ⇒ Object (readonly)
Returns the value of attribute attachment.
3 4 5 |
# File 'lib/tenon/proxy_attachment.rb', line 3 def @attachment end |
Instance Method Details
#display_name ⇒ Object
14 15 16 |
# File 'lib/tenon/proxy_attachment.rb', line 14 def display_name Tenon::AssetDecorator.new(@attachment.instance).display_name end |
#original_filename ⇒ Object
10 11 12 |
# File 'lib/tenon/proxy_attachment.rb', line 10 def original_filename @attachment.original_filename end |
#url(style = :original, *args) ⇒ Object
Prefix with an underscore to use base Asset styles
19 20 21 22 23 24 25 |
# File 'lib/tenon/proxy_attachment.rb', line 19 def url(style = :original, *args) if style.to_sym == :original original_url(*args) else named_url(style, *args) end end |