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",
  "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



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

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



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

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



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

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



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

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



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

def url
  @url
end