Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Example script to showcase editor themes.

module Awesome
  class Yarra < Array
    def map! options = {}, &block
      @called = true
      
      if options[:direction] == :reverse
        self.replace reverse.map(&block)
      else
        super()
      end
    end
    
    def push *elements
      super *elements.reverse
    end
  end
end

def Exclaim message
  message.upcase + " !!" unless $AGITATION_LEVEL == 60
end

EmptyString = %%%

EmptyString.scan /[a-zA-Z0-9]*/ do
  standby = <<-EOS
    Stand by for countdown:
    
  EOS
  puts standby.lstrip
end

yarra = Awesome::Yarra.new

10.times { |i| yarra << i + 1 }

yarra.map!({:direction => :reverse}) do |number|
  %{T minus #{number} second#{"s" if number != 1} ...}
end

yarra.push Exclaim('Impact'), EmptyString

puts yarra