Skip to content

Instantly share code, notes, and snippets.

@hiroeorz
Created May 3, 2014 00:43
Show Gist options
  • Save hiroeorz/11489627 to your computer and use it in GitHub Desktop.
Save hiroeorz/11489627 to your computer and use it in GitHub Desktop.
ツナでもわかるmruby [1回目:Hello World] ref: http://qiita.com/hiroeorz@github/items/112e5bfbb3ff4d9486bc
conf.gembox 'full-core'
$ git clone https://github.com/mruby/mruby.git
$ mruby hello_world.rb
hello world
$ mrbc hello_world.rb
$ ls
hello_world.mrb hello_world.rb
$ mruby -b hello_world.mrb
hello world
>puts "Hello World"
Hello World
=> nil
>
$ mkdir -p mruby-learn/hello_world
$ cd mruby-learn/hello_world
$ mkdir -p /usr/local/mruby/bin
$ cp bin/* /usr/local/mruby/bin/
$ echo "export PATH=/usr/local/mruby/bin:\${PATH}" >> ~/.profile
$ source ~/.profile
$ mruby -b hello_world.mrb
hello world
$ mkdir -p mruby-learn/hello_world
$ cd mruby-learn/hello_world
module Hello
class World
def say!
puts "hello world"
end
end
end
hw = Hello::World.new
hw.say!
> puts "Hello World"
Hello World
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment