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
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.
-
#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.
10 11 12 13 |
# File 'lib/s3_assets_uploader/config.rb', line 10 def initialize self.assets_path = DEFAULT_ASSETS_PATH 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 |
#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
19 20 21 |
# File 'lib/s3_assets_uploader/config.rb', line 19 def public_path assets_path.parent end |
#validate! ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/s3_assets_uploader/config.rb', line 23 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 |