mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
b2d9f1e9d0
* enc/Makefile.in: became a serb template. * enc/make_encmake.rb: creates enc.mk from enc/Makefile.in using serb. * lib/mkmf.rb (relative_from): moved from ext/extmk.rb. * lib/mkmf.rb ($extmk): true if under to top source directory, not only ext. * lib/mkmf.rb (depend_rules): extracted from create_makefile. * tool/serb.rb (serb): splitted from tool/compile_prelude.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
17 lines
326 B
Ruby
17 lines
326 B
Ruby
def serb(str, var)
|
|
result = ''
|
|
str.each_line {|line|
|
|
if /\A!/ =~ line
|
|
result << $'
|
|
else
|
|
line.split(/(<%.*?%>)/).each {|x|
|
|
if /\A<%(.*)%>\z/ =~ x
|
|
result << "#{var} << (#{$1}).to_s\n"
|
|
else
|
|
result << "#{var} << #{x.dump}\n"
|
|
end
|
|
}
|
|
end
|
|
}
|
|
result
|
|
end
|