elrpc 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1135dd028ca222c3b0e669001c0d32768679bbd3
4
- data.tar.gz: d2e441ac4ce8e17c2f583a54c159042e16dbead7
3
+ metadata.gz: f0842836d2200968a4a098eda7ba03664cce8aa7
4
+ data.tar.gz: 53583612a724a0570cd9e072d6401bd3e4d560b7
5
5
  SHA512:
6
- metadata.gz: 0b3a49a73596de83661c80bbd6011da86d84c14fbb0285d24edcd5d9c65fdeea9a700ca74da1258593ad7c07a7ccfc55eded74c52667b1b31de2f599df7d898a
7
- data.tar.gz: 261120b1fb2c299025c6fbd5141e635aa9cb91d10739a4b21e677f9e4fc092cd773371625a1e60ccf55b927301776d0fa9df6a876c8ed2b53fc9417699ec777d
6
+ metadata.gz: 58e64d2116678181e6ae2880ea22050714c26c711deac3e5e896132a901612e3afe234d43168e0d52128ea7fba3e8e9b1e482d8046ca7e09a8e5f92ef5216af5
7
+ data.tar.gz: 39465ff5784968f8495f53329dac6eb393cb408417008c1e02ed365771a3e7bc77d21a98b4b8c3001e72fe5063e9325cabc5c1514a4c546018c11f356bb6dfec
data/lib/elrpc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Elrpc
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/elrpc.rb CHANGED
@@ -529,7 +529,8 @@ module Elrpc
529
529
  @logger.debug "[rcvloop] Socket closed!"
530
530
  break
531
531
  end
532
- @logger.debug "Parse : #{body}"
532
+ body.force_encoding("utf-8")
533
+ @logger.debug "Parse : #{body}/#{body.encoding}"
533
534
  ast = parser.parse(body)
534
535
  raise "Unexpected multiple s-expression : #{body}" if ast.size != 1
535
536
  ast = ast[0].to_ruby
@@ -0,0 +1,55 @@
1
+ (require 'epc)
2
+
3
+ (let (epc)
4
+ ;; start a server process
5
+ ;; bundle exec
6
+ (setq epc (epc:start-epc "bundle" '("exec" "ruby" "sample.rb")))
7
+
8
+ ;; system ruby
9
+ ;;(setq epc (epc:start-epc "ruby" '("sample.rb")))
10
+
11
+ ;; debug process (manual connection)
12
+ ;;(setq epc (epc:start-epc-debug 8888))
13
+
14
+ ;; asynchronous calling
15
+ (deferred:$
16
+ (epc:call-deferred epc 'echo '("hello"))
17
+ (deferred:nextc it
18
+ (lambda (x) (message "Return : %S" x))))
19
+
20
+ ;; synchronous calling (debug purpose)
21
+ (message "%S" (epc:call-sync epc 'echo '(world)))
22
+
23
+ (epc:call-sync epc 'inject '(0 + (1 2 3 4)))
24
+ (epc:call-sync epc 'inject '(1 * (1 2 3 4)))
25
+ (epc:call-sync epc 'inject '("" + ("1" "2" "3" "4")))
26
+
27
+ ;; kill the server process
28
+ (epc:stop-epc epc)
29
+ )
30
+
31
+ ;; just `eval-last-sexp' here
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
data/sample/sample.rb ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'elrpc'
4
+
5
+ # start server
6
+ server = Elrpc.start_server()
7
+
8
+ server.def_method "echo" do |*arg|
9
+ arg
10
+ end
11
+
12
+ server.def_method "add" do |a,b|
13
+ a+b
14
+ end
15
+
16
+ server.def_method "inject","init, op, list","Enumerable#inject" do |init, op, list|
17
+ list.inject(init, op)
18
+ end
19
+
20
+ # sleep the main thread and wait for closing connection
21
+ server.wait
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elrpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - SAKURAI Masashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elparser
@@ -84,6 +84,8 @@ files:
84
84
  - sample/echo-client.el
85
85
  - sample/echo-client.rb
86
86
  - sample/echo.rb
87
+ - sample/sample-client.el
88
+ - sample/sample.rb
87
89
  - test/_add.rb
88
90
  - test/_call_echo.rb
89
91
  - test/_echo.rb