Class: Textus::Step::Builtin::MarkdownLinksFetch

Inherits:
Fetch show all
Defined in:
lib/textus/step/builtin/markdown_links_fetch.rb

Instance Attribute Summary

Attributes inherited from Textus::Step::Base

#name

Instance Method Summary collapse

Methods inherited from Fetch

required_kwargs

Methods inherited from Textus::Step::Base

kind, required_kwargs, step_name

Instance Method Details

#call(config:, args:) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/textus/step/builtin/markdown_links_fetch.rb', line 10

def call(config:, args:, **)
  _ = args
  links = config["bytes"].to_s.scan(%r{\[([^\]]+)\]\((https?://[^)\s]+)\)}).map do |text, href|
    { "text" => text, "href" => href }
  end
  { _meta: {}, body: YAML.dump(links) }
end