Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'erb'
- class ERB
- def self.str(template, binding = TOPLEVEL_BINDING)
- self.new(template, nil, '%<>-').result(binding)
- end
- end
- if __FILE__ == $PROGRAM_NAME
- puts ERB.str(<<-_EOD_)
- Hello, erbstr.
- %
- %
- ----
- % dice_2d6 = rand(6) + rand(6)
- 2D6: <%= dice_2d6 -%>
- % if dice_2d6.even?
- (even)
- % else
- (odd)
- % end
- ----
- %
- %
- % 10.times do |i|
- Loop count: <%= i %>.
- % end
- _EOD_
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement