Sha256: 7a56768d8f3608e0ddc1400b99be7e79bf08e19e00138fa240d001fbfea6c421
Contents?: true
Size: 622 Bytes
Versions: 1
Compression:
Stored size: 622 Bytes
Contents
# frozen_string_literal: true module SiteMaps Process = Concurrent::ImmutableStruct.new(:name, :location_template, :kwargs_template, :block) do def location(**kwargs) return unless location_template location_template % keyword_arguments(kwargs) end def call(builder, **kwargs) return unless block block.call(builder, **keyword_arguments(kwargs)) end def static? !dynamic? end def dynamic? kwargs_template.is_a?(Hash) && kwargs_template.any? end def keyword_arguments(given) (kwargs_template || {}).merge(given || {}) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
site_maps-0.0.1.beta1 | lib/site_maps/process.rb |