update
Former-commit-id: bdede6ed1b6f578f2ef046c338caf02d0b29d453 [formerly 7187de361b53e9c8ec121df379b762f2db736ea2] Former-commit-id: 447d58460fbbfd05ffe08428a1288e392637561d
This commit is contained in:
35
_embed/public/ace/demo/kitchen-sink/docs/ruby.rb
Normal file
35
_embed/public/ace/demo/kitchen-sink/docs/ruby.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
# Program to find the factorial of a number
|
||||
def fact(n)
|
||||
if n == 0
|
||||
1
|
||||
else
|
||||
n * fact(n-1)
|
||||
end
|
||||
end
|
||||
|
||||
puts fact(ARGV[0].to_i)
|
||||
|
||||
class Range
|
||||
def to_json(*a)
|
||||
{
|
||||
'json_class' => self.class.name, # = 'Range'
|
||||
'data' => [ first, last, exclude_end? ]
|
||||
}.to_json(*a)
|
||||
end
|
||||
end
|
||||
|
||||
{:id => ?", :key => "value"}
|
||||
|
||||
|
||||
herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment
|
||||
FOO #{literal}
|
||||
FOO
|
||||
BAR #{fact(10)}
|
||||
BAR
|
||||
BAZ indented
|
||||
BAZ
|
||||
echo hi
|
||||
EXEC
|
||||
puts herDocs
|
||||
Reference in New Issue
Block a user