Class: Hanami::Assets::Config
- Inherits:
-
Object
- Object
- Hanami::Assets::Config
- Includes:
- Dry::Configurable
- Defined in:
- lib/hanami/assets/config.rb
Overview
Hanami assets configuration.
Instance Attribute Summary collapse
- #base_url ⇒ BaseUrl
- #node_command ⇒ String
- #path_prefix ⇒ String
- #subresource_integrity ⇒ Array<Symbol>
Instance Method Summary collapse
-
#crossorigin?(source) ⇒ Boolean
private
Returns true if the given source is linked via Cross-Origin policy (or in other words, if the given source does not satisfy the Same-Origin policy).
-
#initialize(**values) {|config| ... } ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(**values) {|config| ... } ⇒ Config
Returns a new instance of Config.
56 57 58 59 60 61 62 |
# File 'lib/hanami/assets/config.rb', line 56 def initialize(**values) super() config.update(values.select { |k| _settings.key?(k) }) yield(config) if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object (private)
82 83 84 85 86 87 88 |
# File 'lib/hanami/assets/config.rb', line 82 def method_missing(name, ...) if config.respond_to?(name) config.public_send(name, ...) else super end end |
Instance Attribute Details
#base_url ⇒ BaseUrl
52 |
# File 'lib/hanami/assets/config.rb', line 52 setting :base_url, constructor: -> url { BaseUrl.new(url.to_s) } |
#node_command ⇒ String
25 |
# File 'lib/hanami/assets/config.rb', line 25 setting :node_command, default: "node" |
#path_prefix ⇒ String
32 |
# File 'lib/hanami/assets/config.rb', line 32 setting :path_prefix, default: "/assets" |
#subresource_integrity ⇒ Array<Symbol>
42 |
# File 'lib/hanami/assets/config.rb', line 42 setting :subresource_integrity, default: [] |
Instance Method Details
#crossorigin?(source) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns true if the given source is linked via Cross-Origin policy (or in other words, if the given source does not satisfy the Same-Origin policy).
76 77 78 |
# File 'lib/hanami/assets/config.rb', line 76 def crossorigin?(source) base_url.crossorigin?(source) end |