Class: String

Inherits:
Object show all
Includes:
Iolite::Adaptor::Callable, Iolite::Adaptor::ToProc
Defined in:
lib/iolite/adaptored/string.rb

Instance Method Summary collapse

Methods included from Iolite::Adaptor::Callable

#iolite_functinal_invoke_call

Methods included from Iolite::Adaptor::ToProc

#to_proc

Instance Method Details

#call(*args) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/iolite/adaptored/string.rb', line 6

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

#to_call_by_eval(binding = nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/iolite/adaptored/string.rb', line 14

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