Sha256: e2643cbb1203d7b3547ca6a9a110a2d76c0c72a68cfb8ad09abb3cbe2c08ebc6

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

module Crystal
  class InterpolatesTags < Struct.new(:tags)
    def interpolate!
      tags.each{|tag| interpolate_tag!(tag)}
    end

    private

    def interpolate_tag!(tag)
      if tag.value.respond_to?(:gsub)
        tag.value = tag.value.gsub(/%\{([\w:-]+)\}/) do |match|
          interpolate_tag!(tags.find_by_name($1))
        end
      end

      tag.value
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crystalmeta-1.0.0 lib/crystal/interpolates_tags.rb
crystalmeta-0.9.4 lib/crystal/interpolates_tags.rb
crystalmeta-0.9.3 lib/crystal/interpolates_tags.rb