Sha256: 703f12f26669dfc6a51dc7d5f44ccd8f017bea591e0159b2358e3e0c415e3202
Contents?: true
Size: 496 Bytes
Versions: 8
Compression:
Stored size: 496 Bytes
Contents
module Materialist module Materializer module Internals class LinkHrefMapping def initialize(key:, as:, url_parser: nil) @key = key @as = as @url_parser = url_parser end def map(resource) return unless link = resource.dig(:_links, @key) { @as => url_parser.call(link[:href]) } end private def url_parser @url_parser || ->url { url } end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems