Class: EvalIn::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/eval-in/result.rb

Overview

A representation of a result produced by an eval.in query.

Since:

  • 0.0.1

Constant Summary collapse

LANGS =

The languages supported by eval.in. Any of these keys or values will work for the lang parameter in EvalIn.eval.

Since:

  • 0.0.1

{
  "c" => "c/gcc-4.9.1",
  "c++" => "c++/gcc-4.9.1",
  "coffeescript" => "coffeescript/node-0.10.29-coffee-1.7.1",
  "fortran" => "fortran/f95-4.4.3",
  "haskell" => "haskell/hugs98-sep-2006",
  "io" => "io/io-20131204",
  "js" => "javascript/node-0.10.29",
  "lua" => "lua/lua-5.2.3",
  "ocaml" => "ocaml/ocaml-4.01.0",
  "php5" => "php/php-5.6.23",
  "php7" => "php/php-7.0.8",
  "pascal" => "pascal/fpc-2.6.4",
  "perl" => "perl/perl-5.20.0",
  "python" => "python/cpython-3.4.1",
  "python2" => "python/cpython-2.7.8",
  "racket" => "racket/racket-6.10.1",
  "ruby" => "ruby/mri-2.4",
  "slash" => "slash/slash-head",
  "nasm" => "assembly/nasm-2.07",
}.freeze

Instance Attribute Summary collapse

Instance Attribute Details

#codeString (readonly)

Returns the program code used in execution.

Examples:

result.code # => "puts \"hello\""

Returns:

  • (String)

    the program code used in execution

Since:

  • 0.0.1



46
47
48
# File 'lib/eval-in/result.rb', line 46

def code
  @code
end

#languageString (readonly)

Returns the expanded language used in execution.

Examples:

result.language # => "ruby/mri-2.2"

Returns:

  • (String)

    the expanded language used in execution

Since:

  • 0.0.1



41
42
43
# File 'lib/eval-in/result.rb', line 41

def language
  @language
end

#outputString (readonly)

Returns any output produced by the program.

Examples:

result.output # => "hello\n"

Returns:

  • (String)

    any output produced by the program

Since:

  • 0.0.1



51
52
53
# File 'lib/eval-in/result.rb', line 51

def output
  @output
end

#statusString (readonly)

Returns the program's exit status.

Examples:

result.status # => "OK (0 sec real, 0 sec wall, 8 MB, 16 syscalls)"

Returns:

  • (String)

    the program's exit status

Since:

  • 0.0.1



56
57
58
# File 'lib/eval-in/result.rb', line 56

def status
  @status
end

#urlURI (readonly)

Returns a permalink to the output webpage.

Examples:

result.url # => #<URI::HTTPS https://eval.in/xxxxxx>

Returns:

  • (URI)

    a permalink to the output webpage

Since:

  • 0.0.1



61
62
63
# File 'lib/eval-in/result.rb', line 61

def url
  @url
end