Class: PwaManifestGenerator::Intent

Inherits:
Object
  • Object
show all
Includes:
Freezeable
Defined in:
lib/pwa_manifest_generator/intent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Freezeable

included

Constructor Details

#initialize(filters = []) ⇒ Intent

Returns a new instance of Intent.



14
15
16
# File 'lib/pwa_manifest_generator/intent.rb', line 14

def initialize(filters = [])
  @filters = HTMLArray.new(filters)
end

Instance Attribute Details

#filtersObject (readonly)

Returns the value of attribute filters.



12
13
14
# File 'lib/pwa_manifest_generator/intent.rb', line 12

def filters
  @filters
end

Instance Method Details

#to_htmlObject



25
26
27
28
# File 'lib/pwa_manifest_generator/intent.rb', line 25

def to_html
  html = @filters.to_html
  html.respond_to?(:html_safe) ? html.html_safe : html
end

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
# File 'lib/pwa_manifest_generator/intent.rb', line 18

def valid?
  @filters.all? do |filter|
    filter.is_a?(Hash) && filter.key?(:scope_url_scheme) &&
      filter.key?(:scope_url_host) && filter.key?(:scope_url_path)
  end
end