lib/html2rss/config/channel.rb in html2rss-0.10.0 vs lib/html2rss/config/channel.rb in html2rss-0.11.0
- old
+ new
@@ -10,10 +10,19 @@
#
# 1. the RSS channel attributes
# 2. html2rss options like json or custom HTTP-headers for the request
class Channel
##
+ # @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)
+ 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)
@@ -73,18 +82,9 @@
##
# @return [true, false]
def json?
config.fetch(:json, false)
- end
-
- ##
- # @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)
- end
end
private
# @return [Hash<Symbol, Object>]