Sha256: 47e3304aeb73d6feda62d7e24a5e9469dd48935e4fbc084560c06e50e19c1dd4

Contents?: true

Size: 377 Bytes

Versions: 3

Compression:

Stored size: 377 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.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-0.9.2 lib/crystal/interpolates_tags.rb
crystalmeta-0.9.1 lib/crystal/interpolates_tags.rb
crystalmeta-0.9.0 lib/crystal/interpolates_tags.rb