Module: Balloon::Configuration
- Defined in:
- lib/balloon/configuration.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- STORAGE_EGINE =
{ file: "Balloon::Storage::File", upyun: "Balloon::Storage::Upyun" }
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/balloon/configuration.rb', line 10 def included(base) base.extend ClassMethods set_config :root set_config :permissions set_config :dir_permissions set_config :store_storage set_config :cache_dir set_config :store_dir set_config :asset_host set_config :upyun_api_host set_config :upyun_username set_config :upyun_password set_config :upyun_bucket set_config :upyun_timeout set_config :upyun_domain set_config :upyun_thumb_symbol set_config :upyun_is_image set_config :upyun_headers reset_config if base == Balloon::Base end |
.reset_config ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/balloon/configuration.rb', line 48 def reset_config Balloon.configure do |config| config.root = Balloon.root config. = 0644 config. = 0755 config.store_storage = :file config.store_dir = "public" config.cache_dir = "tmp" config.upyun_headers = {} config.upyun_thumb_symbol = '!' config.upyun_is_image = false end end |
.set_config(name) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/balloon/configuration.rb', line 33 def set_config(name) ClassMethods.class_eval <<-RUBY attr_writer :#{name} alias :uploader_#{name} :#{name}= def #{name}; @#{name}; end RUBY class_eval <<-RUBY def #{name} value = self.class.#{name} value.nil? ? Balloon::Base.#{name} : value end RUBY end |