Sha256: 63c9aebff55955f17ba297b0696c7f4989c109fb761dbbdc60b63b1394830b2a

Contents?: true

Size: 414 Bytes

Versions: 3

Compression:

Stored size: 414 Bytes

Contents

require "iolite/placeholders"

class String
	include Iolite::Adaptor::ToProc
	include Iolite::Adaptor::Callable
	def call *args
		result = self.clone
		args.each_with_index { |it, i|
			result.gsub! "#{Iolite::Placeholders.const_get("ARG#{i+1}")}", it.to_s
		}
		result
	end

	def to_call_by_eval binding = nil
		Iolite.lazy { |*args|
			gsub(/#{'#{(.*?)}'}/) {
				eval($1, binding).call(*args)
			}
		}
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
iolite-0.0.3 lib/iolite/adaptored/string.rb
iolite-0.0.2 lib/iolite/adaptored/string.rb
iolite-0.0.1 lib/iolite/adaptored/string.rb