kungfuig 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -2
- data/lib/kungfuig/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 710529a449153af8d6165ab4048a8027d0ac2297
|
4
|
+
data.tar.gz: efe992810bda32c01e2669ba81fab5925dda3a6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c730db342199e07d7601f77e120f278b3b0888870f86d3d252a7ace86d381f61e4b984e2e5257d6ff195939ff1a9cf32b3e60be2da948a6b51816c7afd1e6c29
|
7
|
+
data.tar.gz: 95523cd9b5e349c8109b443991b59f2f9a929e29abe0bfb47e28040d9192ae6aa5f6746139df4a38b022cf79923dd69f5461061904f6dd2f49fd7295ae7eca35
|
data/README.md
CHANGED
@@ -4,7 +4,25 @@
|
|
4
4
|
|
5
5
|
[![Build Status](https://travis-ci.org/am-kantox/kungfuig.svg\?branch\=master)](https://travis-ci.org/am-kantox/kungfuig)
|
6
6
|
|
7
|
-
|
7
|
+
## Config on steroids
|
8
|
+
|
9
|
+
This gem allows to (including but not limited to):
|
10
|
+
|
11
|
+
* easily attach a configuration to any class and/or instance;
|
12
|
+
* attach basic [aspects](https://en.wikipedia.org/wiki/Aspect-oriented_programming)
|
13
|
+
to any existing method on `before` and `after` pointcuts;
|
14
|
+
* bulk attach aspects as defined by `yaml` configuration file
|
15
|
+
(see [Bulk aspects assignment](#bulk-aspects-assignment).)
|
16
|
+
* bulk attach sidekiq jobs as aspects as defined by `yaml` configuration file
|
17
|
+
(see [Bulk jobs assignment](#bulk-jobs-assignment).)
|
18
|
+
* thread-safe configure nested / derived classes / instances.
|
19
|
+
|
20
|
+
## Eastern eggs:
|
21
|
+
|
22
|
+
* easy way to handle console colors:
|
23
|
+
* `Color.to_xterm256('Hello, world!', :info)`
|
24
|
+
* `Color.to_xterm256('Hello, world!', :success)`
|
25
|
+
* `Color.to_xterm256('Hello, world!', '#FFFF00')`
|
8
26
|
|
9
27
|
## Usage
|
10
28
|
|
@@ -44,7 +62,7 @@ class MyApp
|
|
44
62
|
end
|
45
63
|
|
46
64
|
MyApp.kungfuigure do
|
47
|
-
aspect :report do |result|
|
65
|
+
aspect :report do |result| # or just MyApp.aspect :report do |result|
|
48
66
|
puts "MyApp#report returned #{result}"
|
49
67
|
end
|
50
68
|
end
|
@@ -105,6 +123,7 @@ job.perform_async(receiver, method, result, *args)
|
|
105
123
|
instance as by `Sidekiq` convention.)
|
106
124
|
|
107
125
|
```ruby
|
126
|
+
respond_to = ->(m, r) { r.respond_to? m.to_sym }
|
108
127
|
r = case receiver
|
109
128
|
when Hash, Array, String then receiver
|
110
129
|
when respond_to.curry[:to_hash] then receiver.to_hash
|
data/lib/kungfuig/version.rb
CHANGED