client-data-adapter 0.1.0 → 0.1.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
  SHA256:
3
- metadata.gz: 6216761a500dd0fcc1078802338d3a8d540892fe8da2229c1b3fe5d77593ed62
4
- data.tar.gz: 6176e29e6d7584c501708b09b72c9621af509e93fe41b60952ff6ee65b4a17fd
3
+ metadata.gz: 5929dffa53704cde41c2ab3f5472f688678fa8de7a0383e638a3b52781176fa9
4
+ data.tar.gz: d1be7b858a73bdb311833b68cb9895d63855dbfc46ba0f6040ad5cd8ee018389
5
5
  SHA512:
6
- metadata.gz: 4383e461e62527c305161c1b02c9d2d6b2cbc991ebe4d6cc1504d8b349955b42db9e9bb4877802738969b24996088bf9d7c97222088bba968df43203d7860d84
7
- data.tar.gz: 431b1dccf85d3da56bd3cdd35583455c51b6a7261dd64924b274fd786789696ba76765b63026d88dcd7a7d54b317e3fa401035a63370fa6002b65469c489e230
6
+ metadata.gz: 04bef8fde33f7b9107defcf0e13bfabaf25d35ee8dd7b7f106f13e70285cc21cb628ebb07cae95383e21cc0f4f3cb4b2794a9643065c0f20df27b3f4297304a7
7
+ data.tar.gz: '08624aa572e2e24c816eb57140c1357de7ef3a0201bbf8a8d0d506019abced4d65e6c1b6cd8805264ac874076c32c4b82179caaa49d9dd277bfd078304c7256f'
data/README.md CHANGED
@@ -47,7 +47,8 @@ include ClientDataAdapter
47
47
 
48
48
  define_adapter do
49
49
 
50
- # define your adapter here...
50
+ # define your adapter here.
51
+ # ...
51
52
 
52
53
  end
53
54
 
@@ -55,7 +56,7 @@ end
55
56
 
56
57
  ### `adapter`
57
58
 
58
- `adapter` method define the main adapter, and common structure should be a `Hash`.
59
+ `adapter` method define the main adapter, should return a `Hash`.
59
60
 
60
61
  ```ruby
61
62
  # ...
@@ -84,8 +85,8 @@ In elsewhere
84
85
 
85
86
  ### `with`
86
87
 
87
- And you are probably need some complex calculation or related some other class,
88
- they maybe need some cost and don't need to load everywhere.
88
+ And you probably need some complex calculation or related some other class,
89
+ they maybe need some cost and is unnecessary to load everywhere.
89
90
 
90
91
  So we need use them *on-demand*.
91
92
 
@@ -165,8 +166,6 @@ end
165
166
  or this
166
167
 
167
168
  ```ruby
168
- # ...
169
-
170
169
  with :foo do |*args|
171
170
  args.join(',')
172
171
  end
@@ -231,7 +230,7 @@ And you can read the adapter internal method via it.
231
230
  @book.adapter_wrapper.my_method # => works
232
231
  ```
233
232
 
234
- hmm... but i am not very recommend you to use it by this way,
233
+ hmm... but i'm not very recommend you to use it by this way,
235
234
  if you need some method works alone,
236
235
  maybe you should define it in the original class.
237
236
 
@@ -291,12 +290,13 @@ Then
291
290
  ```
292
291
 
293
292
  Of course you can pass some arguments, and if you have several links,
294
- they can also used in nested.
293
+ can also used in nested.
295
294
 
296
295
  ```ruby
297
296
  # ...
298
297
 
299
- @book.adapter(book_shelf: [library: :some_method])
298
+ @book.adapter(book_shelf: [:foo, library: :bar])
299
+ # => { ..., book_shelf: { ..., foo: ..., library: { ..., bar: ... } } }
300
300
  ```
301
301
 
302
302
  And can define many links once.
@@ -336,23 +336,6 @@ end
336
336
 
337
337
  ```
338
338
 
339
- ```ruby
340
- # category.rb
341
-
342
- define_adapter do
343
-
344
- adapter do
345
- {
346
- id: id,
347
- desc: desc,
348
- }
349
- end
350
-
351
- end
352
- ```
353
-
354
- Then
355
-
356
339
  ```ruby
357
340
  @book.adapter(:categories)
358
341
  # => { id: 1, title: 'My Book', categories: @book.categories.map(&:adapter) }
@@ -1,10 +1,12 @@
1
1
  lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
+ require_relative './lib/client-data-adapter/version'
5
+
4
6
  Gem::Specification.new do |s|
5
7
 
6
8
  s.name = 'client-data-adapter'
7
- s.version = '0.1.0'
9
+ s.version = ClientDataAdapter::VERSION
8
10
  s.summary = 'client data adapter'
9
11
  s.description = 'For unify data formats to transfer to clients.'
10
12
  s.authors = ['shadow']
@@ -1,6 +1,11 @@
1
1
  require_relative 'client-data-adapter/class_methods'
2
2
  require_relative 'client-data-adapter/instance_methods'
3
3
 
4
+ # For unify data formats to transfer to clients.
5
+ #
6
+ # Homepage https://github.com/jinghua000/client-data-adapter
7
+ #
8
+ # @author shadow <https://github.com/jinghua000>
4
9
  module ClientDataAdapter
5
10
 
6
11
  def self.included(base)
data/spec/adapter_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require_relative '../demo/book'
2
2
 
3
- RSpec.describe Book do
3
+ RSpec.describe ClientDataAdapter do
4
4
 
5
5
  before(:each) do
6
6
  @book = Book.demo
@@ -1,6 +1,6 @@
1
1
  require_relative '../demo/book'
2
2
 
3
- RSpec.describe Book do
3
+ RSpec.describe ClientDataAdapter do
4
4
 
5
5
  before(:each) do
6
6
  @book = Book.demo
data/spec/link_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require_relative '../demo/book'
2
2
 
3
- RSpec.describe Book do
3
+ RSpec.describe ClientDataAdapter do
4
4
 
5
5
  before(:each) do
6
6
  @book = Book.demo
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client-data-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - shadow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-13 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: For unify data formats to transfer to clients.
14
14
  email:
@@ -37,7 +37,6 @@ files:
37
37
  - lib/client-data-adapter/wrapper.rb
38
38
  - spec/adapter_spec.rb
39
39
  - spec/adapter_wrapper_spec.rb
40
- - spec/demo_spec.rb
41
40
  - spec/link_spec.rb
42
41
  - spec/spec_helper.rb
43
42
  - update.sh
data/spec/demo_spec.rb DELETED
@@ -1,5 +0,0 @@
1
- require_relative '../demo/book'
2
-
3
- RSpec.describe Book do
4
-
5
- end