k_doc 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4dc18e7f82a4c59368f6870a693781586d274f21b8a8df64bd568aa6d0c43262
4
- data.tar.gz: d2328c38cf349291486d22d46572698817df1e00ce64c628eba90d7451e97ca3
3
+ metadata.gz: f3a22296c27473f92f9012c2c58c341cd622041f4f54b853cd098e667e2bd861
4
+ data.tar.gz: 1a39ea8f5f79db0a05204f18b6e070f2083d1bbd756b17ca24de7e0c77208c43
5
5
  SHA512:
6
- metadata.gz: 0c844d63fc520e5dab619f01214a93df2306d60cc6877b923cda7a0963269bac0e6ba69b28b6f3d26fec4418e821d61fd92e84f58d0555b7f7ee9dd46ad5539b
7
- data.tar.gz: 81f55829133fc0f3a2a581da5ec51d370bdc7050fdef00ef2aed7965cb43119ccd182413298894b6b40302848d0fc84eb0e77381676c820a70e2bb8ddd2adcbf
6
+ metadata.gz: d66c94012e5dfed8899f89abdfaf8fd2ae13c3a35b8c31e77b45555d1ce539b66f88ca61fd56b42db6d2c9184c58d6df7cfc14949a40d30e5238e15e9bb5fa42
7
+ data.tar.gz: cb190abbb8f67ad7421a72474245ddaaa44901c70d6f4fd09cdfe7b325b759ff353fd30199396680751b2025a9a6f364a1043480c32551b885038dc7d101ad40
@@ -17,15 +17,21 @@ module KDoc
17
17
  # Any container can be uniquely identified via it's
18
18
  # key, type, namespace and project_key attributes
19
19
  #
20
- # @param [String|Symbol] name Name of the container
21
- # @param [String|Symbol] type Type of the container, defaults to KDoc:: FakeOpinion.new.default_document_type if not set
22
- # @param [String|Symbol] namespace Namespace that the container belongs to
23
- # @param [String|Symbol] project_key Project that the container belongs to
24
- def initialize(key: nil, type: nil, namespace: nil, project_key: nil)
25
- @key = key || SecureRandom.alphanumeric(8)
26
- @type = type || KDoc.opinion.default_document_type
27
- @namespace = namespace || ''
28
- @project_key = project_key || ''
20
+ # @param [Hash] **opts The options
21
+ # @option opts [String|Symbol] name Name of the container
22
+ # @option opts [String|Symbol] type Type of the container, defaults to KDoc:: FakeOpinion.new.default_document_type if not set
23
+ # @option opts [String|Symbol] namespace Namespace that the container belongs to
24
+ # @option opts [String|Symbol] project_key Project that the container belongs to
25
+ def initialize(**opts)
26
+ @key = opts[:key] || SecureRandom.alphanumeric(8)
27
+ @type = opts[:type] || KDoc.opinion.default_document_type
28
+ @namespace = opts[:namespace] || ''
29
+ @project_key = opts[:project_key] || ''
30
+
31
+ # Old name is default_data, wonder if I still need that idea?
32
+ # Most documents live within a hash, some tabular documents such as CSV will use an []
33
+ # @data = slice_option(:default_data) || {}
34
+ @data = opts[:data] || {}
29
35
  end
30
36
 
31
37
  def unique_key
@@ -39,5 +45,11 @@ module KDoc
39
45
  log.kv 'project_key', namespace
40
46
  log.kv 'error', error
41
47
  end
48
+
49
+ attr_writer :data
50
+
51
+ def data
52
+ @data.clone
53
+ end
42
54
  end
43
55
  end
data/lib/k_doc/data.rb CHANGED
@@ -82,14 +82,6 @@ module KDoc
82
82
  # KDoc::Builder::Shotstack.new(@data, key, &block)
83
83
  # end
84
84
 
85
- # def set_data(data)
86
- # @data = data
87
- # end
88
-
89
- def data
90
- @data.clone
91
- end
92
-
93
85
  def data_struct
94
86
  KUtil.data.to_open_struct(data)
95
87
  end
data/lib/k_doc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KDoc
4
- VERSION = '0.0.10'
4
+ VERSION = '0.0.11'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys