csb 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/README.md +26 -0
- data/lib/csb/cols.rb +2 -0
- data/lib/csb/template.rb +1 -2
- data/lib/csb/testing.rb +7 -0
- data/lib/csb/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abfc516a242c529b3b1726b6846609df41e8f617a9b9ceba69ae02d7b28d4026
|
4
|
+
data.tar.gz: d40c9e5d581bad2b10559b41f4935a772943c139432b7ce06837dc88ba65900f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d98d4bfa10070f589622deb111c38a90b4eedcd6df222edb7fe4eb52f807b11a3c8d1dd684f92a2c07c21929c687adb632ce65dd9aacdca3bb2a8d7b4a911447
|
7
|
+
data.tar.gz: fb3283a59df41d2e0e5adcf26d260dc955d4094357aacd39320291000e84e5fb128d2b81550d5efa5e0d56587474fa8bacd118030cfd77ecfcf53f02c9f0166e
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -59,6 +59,32 @@ csv.build
|
|
59
59
|
# 2019/06/02,category3,content2,,dummy
|
60
60
|
```
|
61
61
|
|
62
|
+
### Testing
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
# Your view
|
66
|
+
csv.items = @articles
|
67
|
+
csv.cols = Article.csb_cols
|
68
|
+
|
69
|
+
# Your Model
|
70
|
+
def self.csb_cols
|
71
|
+
Csb.cols.new do |cols|
|
72
|
+
cols.add('Update date') { |r| I18n.l(r.updated_at.to_date) }
|
73
|
+
cols.add('Categories') { |r| r.categories.pluck(:name).join(' ') }
|
74
|
+
cols.add('Title', :title)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Your test
|
79
|
+
require 'csb/testing'
|
80
|
+
|
81
|
+
expect(Article.csb_cols.col_pairs(article)).to eq [
|
82
|
+
['Update date', '2020-01-01'],
|
83
|
+
['Categories', 'test rspec'],
|
84
|
+
['Title', 'Testing'],
|
85
|
+
]
|
86
|
+
```
|
87
|
+
|
62
88
|
## Installation
|
63
89
|
|
64
90
|
Add this line to your application's Gemfile:
|
data/lib/csb/cols.rb
CHANGED
data/lib/csb/template.rb
CHANGED
data/lib/csb/testing.rb
ADDED
data/lib/csb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aki77
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- lib/csb/handler.rb
|
111
111
|
- lib/csb/railtie.rb
|
112
112
|
- lib/csb/template.rb
|
113
|
+
- lib/csb/testing.rb
|
113
114
|
- lib/csb/version.rb
|
114
115
|
homepage: https://github.com/aki77/csb
|
115
116
|
licenses:
|