kungfuig 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -0
  3. data/lib/kungfuig/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8905218b5abb7a2c9ac0668aa231099c56179b50
4
- data.tar.gz: 7982a2d82ed9c149ac87448829c74de604822a89
3
+ metadata.gz: e999acc1963d5ffd0ffdf1674e2ff0deb77bbcc5
4
+ data.tar.gz: 1a6fb95a6bfa7d8c7b3b6945f18b9a894db8bf41
5
5
  SHA512:
6
- metadata.gz: c366a2e8097ba590143b54c9bb8729f7ad91dd29a4ad4e54e880d032c69e227a394fdee869a23d3bf0d14c8c11bbda387870d91428c75b7e7f8207a04e5241b5
7
- data.tar.gz: 69d351ebea278825aff5679861a1fb4d0de0fa82714a337add18a4d9b5b53450f2ca3fd68791f6c137008f0d99d6c711b02b15bec51d6a39dece51dda6a14f77
6
+ metadata.gz: 943bfe719a7c249e4011a4c6fa6c33f46b76a88c5ac6fcef1b2c7f2d1fb33901af17219bed336e1c7570a15d97a6e0fb4095f88fc56c4b32885e2db041ccde3d
7
+ data.tar.gz: 7203a220aabfd53cb84067cc9c25092203f21acf93200c1d566d9960905f01331038e9de030c9870a6fb5248937663aeca9e3135992287439893e1fc76752b03
data/README.md CHANGED
@@ -53,6 +53,67 @@ MyApp.new.report
53
53
  #⇒ "MyApp#report returned 42"
54
54
  ```
55
55
 
56
+ ### Bulk aspects assignment
57
+
58
+ ```ruby
59
+ it 'accepts YAML for bulk attach' do
60
+ yaml = <<YAML
61
+ 'Test':
62
+ after:
63
+ '*': 'MyLogger#debug_after_method_call'
64
+ before:
65
+ 'shutdown': 'MyLogger#info_before_shutdown_call'
66
+ YAML
67
+ expect(Kungfuig::Aspector.bulk(yaml)).to be_truthy
68
+ expect(test.yo(42)).to eq ['Answer given']
69
+ ```
70
+
71
+ in the example above, `MyLogger#debug_after_method_call` will be called
72
+ after _all_ methods of `Test` class, and `MyLogger#info_before_shutdown_call`—before
73
+ `Test#shutdown`.
74
+
75
+ ### Bulk jobs assignment
76
+
77
+ ```ruby
78
+ Kungfuig::Jobber.bulk("#{Rails.root}/config/my_app.yml")
79
+ ```
80
+
81
+ **config/my_app.yml**
82
+
83
+ ```yaml
84
+ 'SessionsController':
85
+ 'login': 'OnLoginJob'
86
+ 'UsersController':
87
+ 'show': 'OnUsersShownJob'
88
+ ```
89
+
90
+ in the example above, `OnLoginJob` will be executed after `SessionsController#login`
91
+ method is called, and `OnUsersShownJob`—after `UsersController#show`.
92
+
93
+ ### Jobs `perform` format
94
+
95
+ The job’s `perform` method will be called with four parameters:
96
+
97
+ ```ruby
98
+ job.perform_async(receiver, method, result, *args)
99
+ ```
100
+
101
+ * `receiver` — the actual method receiver, serialized to the hash (see below);
102
+ * `method` — the actual method name;
103
+ * `result` — the result of call to the method (`nil` for before filters);
104
+ * `args` — arguments, passed to the method; objects will be lost (cast to `String`
105
+ instance as by `Sidekiq` convention.)
106
+
107
+ ```ruby
108
+ r = case receiver
109
+ when Hash, Array, String then receiver
110
+ when respond_to.curry[:to_hash] then receiver.to_hash
111
+ when respond_to.curry[:to_h] then receiver.to_h
112
+ else receiver
113
+ end
114
+ job.perform_async(r, method, result, *args)
115
+ ```
116
+
56
117
  ## Installation
57
118
 
58
119
  Add this line to your application's Gemfile:
@@ -1,3 +1,3 @@
1
1
  module Kungfuig
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kungfuig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kantox LTD
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-30 00:00:00.000000000 Z
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie