Class: Superscript::Ctx
- Inherits:
-
Object
show all
- Defined in:
- lib/superscript/ctx.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
3
4
5
6
|
# File 'lib/superscript/ctx.rb', line 3
def method_missing(*args)
puts "Error: No such command or variable '#{args.first}'"
exit 1
end
|
Instance Method Details
#exit ⇒ Object
22
23
24
|
# File 'lib/superscript/ctx.rb', line 22
def exit
Kernel.exit
end
|
#go(*args) ⇒ Object
8
9
10
|
# File 'lib/superscript/ctx.rb', line 8
def go *args
puts "Go #{args.join(" ")}!"
end
|
#quit ⇒ Object
25
26
27
|
# File 'lib/superscript/ctx.rb', line 25
def quit
exit
end
|
#wait(seconds_or_random_range) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/superscript/ctx.rb', line 12
def wait seconds_or_random_range
amount = if seconds_or_random_range.is_a? Range
rand(seconds_or_random_range)
else
seconds_or_random_range
end
sleep amount
end
|