Top Level Namespace

Defined Under Namespace

Classes: Cuby

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



14
15
16
# File 'lib/cuby/vm.rb', line 14

def method_missing(meth, *args, &block)
  self.class.send(:define_method, meth, *args, &block)
end

Instance Method Details

#include(filename) ⇒ Object

These are all the functions needed for Cuby Pretty cool eh? Jon Vlachoyiannis ([email protected]) (16/10/2009)



6
7
8
# File 'lib/cuby/vm.rb', line 6

def include(filename)
  require filename
end

#main(&block) ⇒ Object



10
11
12
# File 'lib/cuby/vm.rb', line 10

def main(&block)
  instance_eval(&block)
end

#preformat_data(data) ⇒ Object



18
19
20
# File 'lib/cuby/vm.rb', line 18

def preformat_data(data)
  data.gsub(/^\s*\/\//,'#').gsub(/^(\s*)([a-zA-Z_]{1}[a-zA-Z0-9_]*)\s+(.+?)\s*\{/, "\\1\\2 { |\\3|")
end

#shout(argument) ⇒ Object



2
3
4
# File 'lib/cuby/stdio.rb', line 2

def shout argument 
  puts argument.upcase
end