Module: Wandbox

Defined in:
lib/wandbox/cli/compiler_list.rb,
lib/wandbox.rb,
lib/wandbox/cli.rb,
lib/wandbox/web.rb,
lib/wandbox/list.rb,
lib/wandbox/cli/cli.rb,
lib/wandbox/cli/run.rb,
lib/wandbox/version.rb,
lib/wandbox/compiler.rb,
lib/wandbox/converter.rb,
lib/wandbox/cli/compiler.rb

Overview

require “iolite”

Defined Under Namespace

Modules: CLI, Web Classes: Compiler, List

Constant Summary collapse

VERSION =
"0.1.0"
FILE_EXTENTIONS =
{
	".cpp" => "C++",
	".c" => "C",
	".d" => "D",
	".rill" => "Rill",
	".hs" => "Haskell",
	".lhs" => "Haskell",
	".cs" => "C#",
	".pl" => "Perl",
	".py" => "Python",
	".rb" => "Ruby",
	".php" => "PHP",
	".erl" => "Erlang",
	".exs" => "Elixir",
	".js" => "JavaScript",
	".coffee" => "CoffeeScript",
	".sql" => "SQL",
	".scala" => "Scala",
	".lua" => "Lua",
	".rs" => "Rust",
	".vim" => "Vim script",
	".bash" => "Bash script",
	".lazy" => "Lazy K",
	".lisp" => "Lisp",
	".pas" => "Pascal",
	".java" => "Java",
	".groovy" => "Groovy",
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ext2lang(ext) ⇒ Object



36
37
38
39
# File 'lib/wandbox/converter.rb', line 36

def ext2lang ext
	ext = ext.downcase
	FILE_EXTENTIONS[ext]
end

.file2compiler(filename) ⇒ Object



57
58
59
60
# File 'lib/wandbox/converter.rb', line 57

def file2compiler filename
	lang = file2lang filename
	lang2compiler lang if lang
end

.file2lang(filename) ⇒ Object



42
43
44
# File 'lib/wandbox/converter.rb', line 42

def file2lang filename
	ext2lang File.extname filename
end

.lang2compiler(lang) ⇒ Object



52
53
54
# File 'lib/wandbox/converter.rb', line 52

def lang2compiler lang
	lang2compilers(lang).first
end

.lang2compilers(lang) ⇒ Object



47
48
49
# File 'lib/wandbox/converter.rb', line 47

def lang2compilers lang
	Wandbox.list.select_by_language(lang)
end

.listObject



9
10
11
# File 'lib/wandbox.rb', line 9

def list
	List.new Web.list
end

.run(compiler, code, **opt) ⇒ Object



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

def run compiler, code, **opt
	Web.compile opt.merge({compiler: compiler, code: code})
end

Instance Method Details

#run_by_file(filename, **opt) ⇒ Object



19
20
21
# File 'lib/wandbox.rb', line 19

def run_by_file filename, **opt
	
end