Class: Html2rss::MCP::ConfigArgument
- Inherits:
-
Data
- Object
- Data
- Html2rss::MCP::ConfigArgument
- Defined in:
- lib/html2rss/mcp/config_argument.rb
Overview
Feed config supplied over MCP as a hash XOR a YAML string.
Config does not know MCP. YAML parsing stays on Config.from_yaml.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config
8 9 10 |
# File 'lib/html2rss/mcp/config_argument.rb', line 8 def config @config end |
Class Method Details
.parse(config: nil, yaml: nil) ⇒ ConfigArgument
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/html2rss/mcp/config_argument.rb', line 17 def parse(config: nil, yaml: nil) parsed = case [present?(config), present?(yaml)] in [true, false] HashUtil.deep_symbolize_keys(config, context: 'config') in [false, true] Config.from_yaml(yaml) else raise ArgumentError, 'Provide exactly one of config or yaml' end Contract.assert_published_request!(parsed) new(config: parsed) end |