Created
May 1, 2015 13:39
-
-
Save tbpgr/75e3f58b99b39b52e5b9 to your computer and use it in GitHub Desktop.
Opal サンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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