Class: Rextester
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#mem_peak ⇒ Object
readonly
Returns the value of attribute mem_peak.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#run_time ⇒ Object
readonly
Returns the value of attribute run_time.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(lang_id: 12, code: '', input: '', compiler_args: '') ⇒ Rextester
constructor
A new instance of Rextester.
- #run ⇒ Object
Constructor Details
#initialize(lang_id: 12, code: '', input: '', compiler_args: '') ⇒ Rextester
Returns a new instance of Rextester.
9 10 11 12 13 14 |
# File 'lib/rextester.rb', line 9 def initialize(lang_id: 12, code: '', input: '', compiler_args: '') @options = { 'LanguageChoice': lang_id, 'Program': code, 'Input': input, 'CompilerArgs': compiler_args } end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/rextester.rb', line 7 def errors @errors end |
#mem_peak ⇒ Object (readonly)
Returns the value of attribute mem_peak.
7 8 9 |
# File 'lib/rextester.rb', line 7 def mem_peak @mem_peak end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
7 8 9 |
# File 'lib/rextester.rb', line 7 def result @result end |
#run_time ⇒ Object (readonly)
Returns the value of attribute run_time.
7 8 9 |
# File 'lib/rextester.rb', line 7 def run_time @run_time end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
7 8 9 |
# File 'lib/rextester.rb', line 7 def warnings @warnings end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rextester.rb', line 16 def run response = request.parsed_response return if response['Errors'] == 'Too many requests...' @run_time = response['Stats'][23..25].to_f @mem_peak = response['Stats'][65..90].to_i @errors = response['Errors'] @warnings = response['Warnings'] @result = response['Result'] end |