silicon 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd1808042898a077bd8f8c0b8d17c4587ced6256
4
- data.tar.gz: 26ba1b428a0d9ed27cf7b3ef0659608847ea1cf7
3
+ metadata.gz: 94b7004646a848bacec46ed80d72dc4cb2cba593
4
+ data.tar.gz: d0c7e82afa1aaefe8120af198b7783bd58f72759
5
5
  SHA512:
6
- metadata.gz: 47ae3077a06e9525257cc42cffa675574c1f5bfd66387a2233f55722235781003e9aff6df55eafd4a515f4ef4aac86211c388bbe50ff7d6ac05c9317a2a022ea
7
- data.tar.gz: a095fcf274a8e27b80077857ea408fdf303ae3c53a2a6c9faaada252248fb8c97f6f2ef5967662f6a3008c827c6a16041afc4525f172e41ba22c02693b3d14a6
6
+ metadata.gz: c5c84117afa38dfd6490f980e7329b4ff5547e1b679cf5f6da7f74e6c7a65545c02691cdde8bb47247f439d23f2cafd3026ab059fb22ccacdcedc11a26511c69
7
+ data.tar.gz: 071e52fff0c832430029603118d2845231c39cdb4d293318bf637885cea7456a12f005142a2242855c5ee269f022e6c949dac641d9db3f190f460be47a958442
data/README.md CHANGED
@@ -30,7 +30,7 @@ own language for that. Small example:
30
30
  ```
31
31
  :receive
32
32
  .->
33
- :before -> load_current_user
33
+ :before -> user@load_current_user
34
34
  /posts ->
35
35
  $id ->
36
36
  :before -> load_post
@@ -11,10 +11,10 @@ module Silicon
11
11
 
12
12
  def execute
13
13
  if @catch_command.nil?
14
- run_actions
14
+ run_commands
15
15
  else
16
16
  begin
17
- run_actions
17
+ run_commands
18
18
  rescue Exception => error
19
19
  @container
20
20
  .register_instance(error, :silicon_error)
@@ -29,7 +29,7 @@ module Silicon
29
29
 
30
30
  private
31
31
 
32
- def run_actions
32
+ def run_commands
33
33
  threads = []
34
34
  Thread.abort_on_exception = true
35
35
  @commands.each_with_index do |command, index|
@@ -38,11 +38,11 @@ module Silicon
38
38
  threads.each {|t| t.join}
39
39
  threads = []
40
40
 
41
- run_action(command.name)
41
+ run_command(command)
42
42
  else
43
43
  thread = Thread.new {
44
44
  Timeout::timeout(@async_timeout) {
45
- run_action(command.name)
45
+ run_command(command)
46
46
  }
47
47
  }
48
48
  threads << thread if command.parallel?
@@ -55,13 +55,12 @@ module Silicon
55
55
  end
56
56
  end
57
57
 
58
- def run_action(name)
59
- action = @container.resolve(name.to_sym)
58
+ def run_command(command)
59
+ action = @container.resolve(command.name.to_sym)
60
60
  result = action.call
61
- result_name = action.respond_to?(:result_name) ? action.result_name : "#{name}_result"
62
61
 
63
62
  @container
64
- .register_instance(result, result_name.to_sym)
63
+ .register_instance(result, command.result_name.to_sym)
65
64
  .using_lifetime(:scope)
66
65
  .bound_to(:silicon_request)
67
66
  end
@@ -14,6 +14,7 @@ module Syntax
14
14
  @result_name = parts[0]
15
15
  @name = parts[1]
16
16
  else
17
+ @result_name = "#{full_name}_result"
17
18
  @name = full_name
18
19
  end
19
20
 
@@ -1,3 +1,3 @@
1
1
  module Silicon
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.5.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kalinkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-30 00:00:00.000000000 Z
11
+ date: 2018-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hypo