2020-10-10 14:16:11 +02:00
|
|
|
# typed: true
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
module Cask
|
2016-09-24 13:52:43 +02:00
|
|
|
class DSL
|
2020-08-24 23:09:43 +02:00
|
|
|
# Class corresponding to the `appcast` stanza.
|
|
|
|
#
|
|
|
|
# @api private
|
2016-09-24 13:52:43 +02:00
|
|
|
class Appcast
|
2020-05-19 15:47:56 +01:00
|
|
|
attr_reader :uri, :parameters, :must_contain
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2017-10-04 15:47:53 +02:00
|
|
|
def initialize(uri, **parameters)
|
|
|
|
@uri = URI(uri)
|
|
|
|
@parameters = parameters
|
2020-05-19 15:47:56 +01:00
|
|
|
@must_contain = parameters[:must_contain] if parameters.key?(:must_contain)
|
2016-09-24 13:52:43 +02:00
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2016-09-24 13:52:43 +02:00
|
|
|
def to_yaml
|
2017-10-04 15:47:53 +02:00
|
|
|
[uri, parameters].to_yaml
|
2016-09-24 13:52:43 +02:00
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2016-09-24 13:52:43 +02:00
|
|
|
def to_s
|
2017-10-04 15:47:53 +02:00
|
|
|
uri.to_s
|
2016-09-24 13:52:43 +02:00
|
|
|
end
|
|
|
|
end
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|