Sha256: 402b4e41914d572fc297d284879ede4787f5ec7bef5b3c9ec99ea60e597c43f1
Contents?: true
Size: 608 Bytes
Versions: 2
Compression:
Stored size: 608 Bytes
Contents
module Ore module Template module Interpolations @@keywords = %w[ name project_dir namespace_dir ] protected def interpolate(path) dirs = path.split(File::SEPARATOR) dirs.each do |dir| dir.gsub!(/(:[a-z_]+:)/) do |capture| keyword = capture[1..-2] if @@keywords.include?(keyword) instance_variable_get("@#{keyword}") else capture end end end return File.join(dirs.reject { |dir| dir.empty? }) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ore-0.1.3 | lib/ore/template/interpolations.rb |
ore-0.1.2 | lib/ore/template/interpolations.rb |