Class: PwaManifestGenerator::Shortcut
- Inherits:
-
Object
- Object
- PwaManifestGenerator::Shortcut
- Defined in:
- lib/pwa_manifest_generator/shortcut.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#icons ⇒ Object
Returns the value of attribute icons.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(name:, url:, description:, icons: []) ⇒ Shortcut
constructor
A new instance of Shortcut.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, url:, description:, icons: []) ⇒ Shortcut
Returns a new instance of Shortcut.
9 10 11 12 13 14 15 16 |
# File 'lib/pwa_manifest_generator/shortcut.rb', line 9 def initialize(name:, url:, description:, icons: []) @name = name @url = url @description = description @icons = icons.map do |icon| icon.is_a?(Icon) ? icon : Icon.new(**icon) end end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/pwa_manifest_generator/shortcut.rb', line 7 def description @description end |
#icons ⇒ Object
Returns the value of attribute icons.
7 8 9 |
# File 'lib/pwa_manifest_generator/shortcut.rb', line 7 def icons @icons end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/pwa_manifest_generator/shortcut.rb', line 7 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/pwa_manifest_generator/shortcut.rb', line 7 def url @url end |
Instance Method Details
#to_h ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/pwa_manifest_generator/shortcut.rb', line 18 def to_h { name: @name, url: @url, description: @description, icons: @icons.map(&:to_h) } end |