lib/html2rss/config/channel.rb in html2rss-0.12.0 vs lib/html2rss/config/channel.rb in html2rss-0.13.0

- old
+ new

@@ -14,19 +14,21 @@ ## # @param config [Hash<Symbol, Object>] # @return [Set<String>] the required parameter names def self.required_params_for_config(config) config.each_with_object(Set.new) do |(_, value), required_params| - required_params.merge(value.scan(/%<([\w_\d]+)>/).flatten) if value.is_a?(String) + required_params.merge(value.scan(/%<(\w+)>[s|d]/).flatten) if value.is_a?(String) end end ## # @param channel [Hash<Symbol, Object>] # @param params [Hash] def initialize(channel, params: {}) raise ArgumentError, 'channel must be a hash' unless channel.is_a?(Hash) - raise ArgumentError, 'missing key :url' unless channel[:url].is_a?(String) + + url = channel[:url] + raise ArgumentError, 'missing key :url' unless url.is_a?(String) || url.is_a?(Addressable::URI) @config = process_params(channel, params.transform_keys(&:to_sym)) end ##