Skip to content

Instantly share code, notes, and snippets.

@tbpgr
Created May 1, 2015 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbpgr/75e3f58b99b39b52e5b9 to your computer and use it in GitHub Desktop.
Save tbpgr/75e3f58b99b39b52e5b9 to your computer and use it in GitHub Desktop.
Opal サンプル
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Opal Sample</title>
<script src="http://cdn.opalrb.org/opal/current/opal.min.js"></script>
<script src="http://cdn.opalrb.org/opal/current/opal-parser.min.js"></script>
</head>
<body>
<script type="text/ruby">
3.times { |i| puts "Hello Opal #{i}" }
puts ('a'..'f').map(&:upcase)
Person = Struct.new(:name, :age)
tanaka = Person.new('tanaka', 34)
suzuki = Person.new('suzuki', 23)
[tanaka, suzuki].map { |e|"#{e.name} - #{e.name}" }.each(&method(:puts))
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment