Class: S3AssetsUploader::Config
- Inherits:
-
Struct
- Object
- Struct
- S3AssetsUploader::Config
- Defined in:
- lib/s3_assets_uploader/config.rb
Defined Under Namespace
Classes: ValidationError
Constant Summary collapse
- DEFAULT_ASSETS_PATH =
'public/assets'.freeze
- DEFAULT_CACHE_CONTROL =
'max-age=2592000, public'
Instance Attribute Summary collapse
-
#additional_paths ⇒ Object
Returns the value of attribute additional_paths.
-
#assets_path ⇒ Object
Returns the value of attribute assets_path.
-
#assets_prefix ⇒ Object
Returns the value of attribute assets_prefix.
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#cache_control ⇒ Object
Returns the value of attribute cache_control.
-
#s3_client ⇒ Object
Returns the value of attribute s3_client.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #public_path ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 |
# File 'lib/s3_assets_uploader/config.rb', line 11 def initialize self.assets_path = DEFAULT_ASSETS_PATH self.cache_control = DEFAULT_CACHE_CONTROL self.additional_paths = [] end |
Instance Attribute Details
#additional_paths ⇒ Object
Returns the value of attribute additional_paths
4 5 6 |
# File 'lib/s3_assets_uploader/config.rb', line 4 def additional_paths @additional_paths end |
#assets_path ⇒ Object
Returns the value of attribute assets_path
4 5 6 |
# File 'lib/s3_assets_uploader/config.rb', line 4 def assets_path @assets_path end |
#assets_prefix ⇒ Object
Returns the value of attribute assets_prefix
4 5 6 |
# File 'lib/s3_assets_uploader/config.rb', line 4 def assets_prefix @assets_prefix end |
#bucket ⇒ Object
Returns the value of attribute bucket
4 5 6 |
# File 'lib/s3_assets_uploader/config.rb', line 4 def bucket @bucket end |
#cache_control ⇒ Object
Returns the value of attribute cache_control
4 5 6 |
# File 'lib/s3_assets_uploader/config.rb', line 4 def cache_control @cache_control end |
#s3_client ⇒ Object
Returns the value of attribute s3_client
4 5 6 |
# File 'lib/s3_assets_uploader/config.rb', line 4 def s3_client @s3_client end |
Instance Method Details
#public_path ⇒ Object
21 22 23 |
# File 'lib/s3_assets_uploader/config.rb', line 21 def public_path assets_path.parent end |
#validate! ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/s3_assets_uploader/config.rb', line 25 def validate! if bucket.nil? raise ValidationError.new('config.bucket must be set') end additional_paths.each do |path| assert_under_public_path!(path) end self.s3_client ||= create_default_client true end |