eval_in 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4ccfaf7503c99eaaece5c964e2dcbe82271ed1eb
4
+ data.tar.gz: 87787a87e7f4540c0c021219a6959efb6f2cc247
5
+ SHA512:
6
+ metadata.gz: 3fa266438bdf528ec9d025bb63a858beb5aeea37e215d5ba0ace45badd654dd7eb88049c74af616104f58857c6dcb85c910d2386ce817816d041f19d7ebe93d5
7
+ data.tar.gz: 350cc67567a1f13b103641cdb7517d2cc802b3e797167a34a622bd8447a4b87f2306d1f92093d3e3664731b57df75a692c963c12e7187d4f5d7fa8ea3ae0be27
@@ -3,6 +3,7 @@
3
3
  require 'uri'
4
4
  require 'json'
5
5
  require 'net/http'
6
+ require 'pathname'
6
7
  require 'eval_in/version'
7
8
 
8
9
  module EvalIn
@@ -68,6 +69,10 @@ module EvalIn
68
69
  attributes[name.to_s] = public_send name
69
70
  end
70
71
  end
72
+
73
+ def to_json
74
+ JSON.dump(as_json)
75
+ end
71
76
  end
72
77
 
73
78
  # @param code [String] the code to evaluate.
@@ -1,3 +1,3 @@
1
1
  module EvalIn
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
@@ -137,6 +137,23 @@ RSpec.describe EvalIn::Result do
137
137
  'status' => 's',
138
138
  'url' => 'u'
139
139
  end
140
+
141
+ it 'has a to_json that works correctly' do
142
+ result = EvalIn::Result.new(language: 'l',
143
+ language_friendly: 'lf',
144
+ code: 'c',
145
+ output: 'o',
146
+ status: 's',
147
+ url: 'u')
148
+ after_json = JSON.parse(result.to_json)
149
+ expect(after_json).to eq 'exitstatus' => -1,
150
+ 'language' => 'l',
151
+ 'language_friendly' => 'lf',
152
+ 'code' => 'c',
153
+ 'output' => 'o',
154
+ 'status' => 's',
155
+ 'url' => 'u'
156
+ end
140
157
  end
141
158
 
142
159
 
metadata CHANGED
@@ -1,67 +1,80 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eval_in
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
4
+ version: 0.1.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Josh Cheek
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-09-01 00:00:00.000000000 Z
11
+ date: 2014-09-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: webmock
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '1.18'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '1.18'
46
- description: ! "Safely evaluates code (Ruby and others) by sending it through https://eval.in\n\n==
47
- Languages and Versions\n\n Ruby | MRI 1.0, MRI 1.8.7, MRI 1.9.3, MRI 2.0.0,
48
- MRI 2.1\n C | GCC 4.4.3, GCC 4.9.1\n C++ | C++11 (GCC 4.9.1),
49
- GCC 4.4.3, GCC 4.9.1\n CoffeeScript | CoffeeScript 1.7.1 (Node 0.10.29)\n Fortran
50
- \ | F95 (GCC 4.4.3)\n Haskell | Hugs98 September 2006\n Io |
51
- Io 20131204\n JavaScript | Node 0.10.29\n Lua | Lua 5.1.5, Lua 5.2.3\n
52
- \ OCaml | OCaml 4.01.0\n PHP | PHP 5.5.14\n Pascal |
53
- Free Pascal 2.6.4\n Perl | Perl 5.20.0\n Python | CPython 2.7.8,
54
- CPython 3.4.1\n Slash | Slash HEAD\n x86 Assembly | NASM 2.07\n\n== Example:\n\nIt's
55
- this simple:\n\n result = EvalIn.call 'puts \"example\"', language: \"ruby/mri-2.1\"\n
56
- \ result.output # returns \"example\\n\"\n\n"
41
+ description: |+
42
+ Safely evaluates code (Ruby and others) by sending it through https://eval.in
43
+
44
+ == Languages and Versions
45
+
46
+ Ruby | MRI 1.0, MRI 1.8.7, MRI 1.9.3, MRI 2.0.0, MRI 2.1
47
+ C | GCC 4.4.3, GCC 4.9.1
48
+ C++ | C++11 (GCC 4.9.1), GCC 4.4.3, GCC 4.9.1
49
+ CoffeeScript | CoffeeScript 1.7.1 (Node 0.10.29)
50
+ Fortran | F95 (GCC 4.4.3)
51
+ Haskell | Hugs98 September 2006
52
+ Io | Io 20131204
53
+ JavaScript | Node 0.10.29
54
+ Lua | Lua 5.1.5, Lua 5.2.3
55
+ OCaml | OCaml 4.01.0
56
+ PHP | PHP 5.5.14
57
+ Pascal | Free Pascal 2.6.4
58
+ Perl | Perl 5.20.0
59
+ Python | CPython 2.7.8, CPython 3.4.1
60
+ Slash | Slash HEAD
61
+ x86 Assembly | NASM 2.07
62
+
63
+ == Example:
64
+
65
+ It's this simple:
66
+
67
+ result = EvalIn.call 'puts "example"', language: "ruby/mri-2.1"
68
+ result.output # returns "example\n"
69
+
57
70
  email:
58
71
  - josh.cheek@gmail.com
59
72
  executables: []
60
73
  extensions: []
61
74
  extra_rdoc_files: []
62
75
  files:
63
- - .gitignore
64
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".travis.yml"
65
78
  - Gemfile
66
79
  - Readme.md
67
80
  - eval_in.gemspec
@@ -71,27 +84,26 @@ files:
71
84
  homepage: https://github.com/JoshCheek/eval_in
72
85
  licenses:
73
86
  - WTFPL
87
+ metadata: {}
74
88
  post_install_message:
75
89
  rdoc_options: []
76
90
  require_paths:
77
91
  - lib
78
92
  required_ruby_version: !ruby/object:Gem::Requirement
79
- none: false
80
93
  requirements:
81
- - - ! '>='
94
+ - - ">="
82
95
  - !ruby/object:Gem::Version
83
96
  version: '0'
84
97
  required_rubygems_version: !ruby/object:Gem::Requirement
85
- none: false
86
98
  requirements:
87
- - - ! '>='
99
+ - - ">="
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  requirements: []
91
103
  rubyforge_project:
92
- rubygems_version: 1.8.23.2
104
+ rubygems_version: 2.4.1
93
105
  signing_key:
94
- specification_version: 3
106
+ specification_version: 4
95
107
  summary: Evaluates code (Ruby and others) safely by sending it to https://eval.in
96
108
  test_files:
97
109
  - spec/eval_in_spec.rb