Module: Audioproxy
- Defined in:
- lib/audioproxy.rb,
lib/audioproxy/rails.rb,
lib/audioproxy/config.rb,
lib/audioproxy/signer.rb,
lib/audioproxy/options.rb,
lib/audioproxy/version.rb,
lib/audioproxy/url_builder.rb,
lib/audioproxy/rails/helpers.rb,
lib/audioproxy/rails/railtie.rb,
lib/audioproxy/rails/blob_resolver.rb
Overview
Nothing in this namespace may reference Rails constants; ActiveSupport is fair game except inside Audioproxy::Signer, which stays liftable. See D1.
Defined Under Namespace
Modules: Options, Rails Classes: Config, ConfigurationError, Signer, UnattachedError, UnsupportedServiceError, UrlBuilder
Constant Summary collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
- .config ⇒ Object
-
.source_resolver ⇒ Object
readonly
Anything that is not already a source String is handed to this resolver.
Class Method Summary collapse
- .configure {|config| ... } ⇒ Object
- .register_source_resolver(resolver = nil, &block) ⇒ Object
- .reset_source_resolver ⇒ Object
-
.url_for(source, **options) ⇒ Object
Single public entry point: usable from jobs, mailers and serializers of any Ruby program, Rails or not.
Class Attribute Details
.source_resolver ⇒ Object (readonly)
Anything that is not already a source String is handed to this resolver.
The Rails layer registers one for ActiveStorage objects; the core stays
ignorant of what a blob is, which is what keeps url_for usable with no
Rails loaded at all (D5).
32 33 34 |
# File 'lib/audioproxy.rb', line 32 def source_resolver @source_resolver end |
Class Method Details
.configure {|config| ... } ⇒ Object
17 18 19 20 |
# File 'lib/audioproxy.rb', line 17 def configure yield config config end |
.register_source_resolver(resolver = nil, &block) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/audioproxy.rb', line 34 def register_source_resolver(resolver = nil, &block) resolver ||= block unless resolver.respond_to?(:call) raise ArgumentError, "an Audioproxy source resolver must respond to #call, got #{resolver.class}" end @source_resolver = resolver end |
.reset_source_resolver ⇒ Object
44 45 46 |
# File 'lib/audioproxy.rb', line 44 def reset_source_resolver @source_resolver = nil end |
.url_for(source, **options) ⇒ Object
Single public entry point: usable from jobs, mailers and serializers of any Ruby program, Rails or not.
24 25 26 |
# File 'lib/audioproxy.rb', line 24 def url_for(source, **) UrlBuilder.new(config).url_for(source, **) end |