Class: PwaManifestGenerator::Builder
- Inherits:
-
Object
- Object
- PwaManifestGenerator::Builder
- Includes:
- Freezeable
- Defined in:
- lib/pwa_manifest_generator/builder.rb
Class Method Summary collapse
-
.config(&block) ⇒ Object
Rails-style config method (class and instance).
-
.instance ⇒ Object
Singleton instance for Rails config.
Instance Method Summary collapse
- #config {|_self| ... } ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #validate_key!(key) ⇒ Object
Methods included from Freezeable
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
32 33 34 35 36 |
# File 'lib/pwa_manifest_generator/builder.rb', line 32 def initialize @launch_handler = LaunchHandler.new @intent = Intent.new @url_handlers = UrlHandler.new end |
Class Method Details
.config(&block) ⇒ Object
Rails-style config method (class and instance)
22 23 24 |
# File 'lib/pwa_manifest_generator/builder.rb', line 22 def self.config(&block) instance.config(&block) end |
.instance ⇒ Object
Singleton instance for Rails config
16 17 18 |
# File 'lib/pwa_manifest_generator/builder.rb', line 16 def self.instance @instance ||= new end |
Instance Method Details
#config {|_self| ... } ⇒ Object
26 27 28 29 30 |
# File 'lib/pwa_manifest_generator/builder.rb', line 26 def config yield self if block_given? self.class.freeze_config!(self) self end |
#validate_key!(key) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/pwa_manifest_generator/builder.rb', line 38 def validate_key!(key) ManifestMap.ensure_valid_key(self, key) # Deep validation for nested objects value = send(key) if value.respond_to?(:valid?) && !value.valid? raise ArgumentError, "Invalid value for #{key}: #{value.inspect}" end true end |