Sha256: a1c9b342cf521d8789615bb9ccf07dbd0a3f38dbac9a094e595a513709b7d11e

Contents?: true

Size: 376 Bytes

Versions: 2

Compression:

Stored size: 376 Bytes

Contents

module Attachs
  class Interpolations

    def exist?(name)
      registry.has_key? name
    end

    def find(name)
      if exist?(name)
        registry[name]
      else
        raise "Interpolation #{name} not found"
      end
    end

    def add(name, &block)
      registry[name] = block
    end

    private

    def registry
      @registry ||= {}
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
attachs-4.0.0.1 lib/attachs/interpolations.rb
attachs-4.0.0.0 lib/attachs/interpolations.rb