Class: CarrierWaveDirect::Policies::Base
- Inherits:
-
Object
- Object
- CarrierWaveDirect::Policies::Base
- Defined in:
- lib/carrierwave_direct/policies/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#uploader ⇒ Object
readonly
Returns the value of attribute uploader.
Instance Method Summary collapse
- #clear! ⇒ Object
-
#initialize(uploader) ⇒ Base
constructor
A new instance of Base.
- #policy(options = {}, &block) ⇒ Object
Constructor Details
#initialize(uploader) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/carrierwave_direct/policies/base.rb', line 5 def initialize(uploader) @uploader = uploader end |
Instance Attribute Details
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
4 5 6 |
# File 'lib/carrierwave_direct/policies/base.rb', line 4 def uploader @uploader end |
Instance Method Details
#clear! ⇒ Object
16 17 18 |
# File 'lib/carrierwave_direct/policies/base.rb', line 16 def clear! @policy = nil end |
#policy(options = {}, &block) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/carrierwave_direct/policies/base.rb', line 9 def policy( = {}, &block) [:expiration] ||= uploader.upload_expiration [:min_file_size] ||= uploader.min_file_size [:max_file_size] ||= uploader.max_file_size @policy ||= generate(, &block) end |