kdict 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.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/.yardopts +3 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +43 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +301 -0
  11. data/Rakefile +8 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/docs/Between.html +302 -0
  15. data/docs/Bool.html +121 -0
  16. data/docs/Example1.md +195 -0
  17. data/docs/FalseClass.html +143 -0
  18. data/docs/KDict/Error.html +135 -0
  19. data/docs/KDict.html +128 -0
  20. data/docs/Kdict/Error.html +135 -0
  21. data/docs/Kdict.html +157 -0
  22. data/docs/Kdict_.html +143 -0
  23. data/docs/KwargDict.html +697 -0
  24. data/docs/KwargModel.html +638 -0
  25. data/docs/KwargTypes.html +988 -0
  26. data/docs/Numeric.html +148 -0
  27. data/docs/TrueClass.html +143 -0
  28. data/docs/_index.html +184 -0
  29. data/docs/class_list.html +51 -0
  30. data/docs/css/common.css +1 -0
  31. data/docs/css/full_list.css +58 -0
  32. data/docs/css/style.css +496 -0
  33. data/docs/file.Example1.html +240 -0
  34. data/docs/file.README.html +370 -0
  35. data/docs/file_list.html +61 -0
  36. data/docs/frames.html +17 -0
  37. data/docs/index.html +370 -0
  38. data/docs/js/app.js +303 -0
  39. data/docs/js/full_list.js +216 -0
  40. data/docs/js/jquery.js +4 -0
  41. data/docs/method_list.html +187 -0
  42. data/docs/top-level-namespace.html +112 -0
  43. data/examples/example1.rb +90 -0
  44. data/kdict.gemspec +39 -0
  45. data/lib/kdict/kwargdict/kwargtypes/bool.rb +9 -0
  46. data/lib/kdict/kwargdict/kwargtypes.rb +196 -0
  47. data/lib/kdict/kwargdict.rb +75 -0
  48. data/lib/kdict/kwargmodel.rb +40 -0
  49. data/lib/kdict/version.rb +5 -0
  50. data/lib/kdict.rb +19 -0
  51. data/ndoc/checksums +6 -0
  52. data/ndoc/complete +0 -0
  53. data/ndoc/object_types +0 -0
  54. data/ndoc/objects/root.dat +0 -0
  55. data/ndoc/proxy_types +0 -0
  56. metadata +150 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 495fd2e9c4e09c817dde4723b7f6aa49ebfb16827514fa5a644b1ef55aae7473
4
+ data.tar.gz: b256e6b5abf92224ebac083ac5e68a3eab341f521666c9c240ee679364436fac
5
+ SHA512:
6
+ metadata.gz: bab14be49b5d1c74a372e66c79af2aeaf70e4269590fb2cc26d1948f5b18f7d4930b6df4579a1c7ae22a9f9731c7acda5e469549fb588b37bd145307afd37b34
7
+ data.tar.gz: 7f01a700d43f2593b05997519cfa2ae9b0112fbc90b8a88bfc9fe3c8db2b7e7fc9ed1dc409161498b00427a3d8e8ca698b38faefa75c7f5196d060779f2ebd59
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+
9
+ /testing.rb
10
+ /testing2.rb
11
+ /kdict.code-workspace
12
+ /startup.md
13
+ /.directory
14
+ # rspec failure tracking
15
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.2
7
+ before_install: gem install bundler -v 2.0.1
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ -
2
+ --output-dir docs
3
+ docs/Example1.md
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at stkterry@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in kdict.gemspec
4
+ gem 'pry'
5
+ gem 'yard'
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kdict (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ diff-lcs (1.3)
11
+ method_source (0.9.2)
12
+ pry (0.12.2)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.9.0)
15
+ rake (10.5.0)
16
+ rspec (3.8.0)
17
+ rspec-core (~> 3.8.0)
18
+ rspec-expectations (~> 3.8.0)
19
+ rspec-mocks (~> 3.8.0)
20
+ rspec-core (3.8.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-expectations (3.8.2)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-mocks (3.8.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.8.0)
28
+ rspec-support (3.8.0)
29
+ yard (0.9.19)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler (~> 2.0)
36
+ kdict!
37
+ pry
38
+ rake (~> 10.0)
39
+ rspec (~> 3.0)
40
+ yard
41
+
42
+ BUNDLED WITH
43
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 atomyc-py
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,301 @@
1
+ # KDict - A Kwarg Dictionary
2
+
3
+ KDict allows you to quickly create powerful Keyword-Argument Dictionaries. Each
4
+ entry can be used to validate a user's input against it, and is built from a
5
+ generic type defintion (*typedef*) and a unique structure (*struct*).
6
+
7
+ With the included *typedefs* users can create simple to complex validaters in
8
+ just a single line of code.
9
+
10
+ Examples avaible here in the README don't offer up the full scope of usefulness,
11
+ so take the time to look at the example documentation in the full docs page.
12
+
13
+ View full docs at: https://stkterry.github.io/KDict/
14
+
15
+ View source code at: https://github.com/stkterry/KDict/
16
+
17
+ {file:doc/Example1.md}
18
+
19
+ *Note: I'm very new to Ruby, less than a month in, as it were. I suspect this thing might change quite a bit
20
+ as I better familiarize myself with everything.*
21
+
22
+ ***
23
+
24
+ ### KwargDict
25
+ This class defines a new, empty dictionary which can be filled with KwargModels.
26
+ The class inherits Hash.
27
+ #### Initialization:
28
+ ```ruby
29
+ kdict = KwargDict.new
30
+ ```
31
+
32
+ #### Adding Models to the Dictionary:
33
+ Each entry in the dictionary gets a name and the appropriate parameters used to
34
+ construct a KwargModel.
35
+ As an example the following definitions might be used in an app where the user is
36
+ allowed to modify a label, it's fontsize, it's color, and x_data for a graph.
37
+
38
+ ```ruby
39
+ kdict[:label] = :typeof, String
40
+ kdict[:fontsize] = :typeof, Integer
41
+ kdict[:rgb] = :formof, [Integer]*3, Proc.new { |n| n.ibetween?(0, 255) }
42
+ kdict[:x_data] = :arrayof, Float
43
+
44
+ # Or if you prefer a single command
45
+ kdict.add([:one, :typeof, Bool], [:two, :kwargsof, anotherKwargModel],
46
+ [:three, :anyof, ['this', 'or', 'that']]) # ... etc.
47
+ ```
48
+ #### KwargModel Structure
49
+ Each entry in the dictionary is defined by its name and by two or three parameters.
50
+
51
+ * **type** - The model's generic type
52
+ * **struct** - The model's structure/definition
53
+ * **prc** - An optional Proc that increases specificity of the model's defintion.
54
+ * *not all typedefs allow for an optional Proc*
55
+
56
+ #### Checking Input Against the Dictionary:
57
+ In the user's main code, one need only provide a single line to test input
58
+
59
+ ```ruby
60
+ kdict.check(:label, "Is This A Good Label?") # => true
61
+ kdict.check(:lable, "A mispelled kword") # => false
62
+ kdict.check(:fontsize, 16) # => true
63
+ kdict.check(:fontsize, '16') # => false
64
+ kdict.check(:rgb, [125, 0, 223]) # => true
65
+ kdict.check(:rgb, [256, 0, 192]) # => false
66
+ kdict.check(:rgb, [125, 0]) # => false
67
+ kdict.check(:x_data, [1.3, 2.5, 4.0, 11.1]) # => true
68
+ #... etc.
69
+ ```
70
+ ***
71
+
72
+ ### Where Is This Useful?
73
+ Any application that might have a large number of optional parameters across
74
+ several different methods, such as graphing libs and user-databases.
75
+
76
+ #### Example Implementation Snippet:
77
+ A user made want to format strings and pass them on to an interpreter or other application.
78
+
79
+ ```ruby
80
+ class MyFigure
81
+ include TextKwargs # <- A predefined KwargDict (text_dict) would be included in this module.
82
+ attr_reader :my_params
83
+ def initialize(title)
84
+ @title = title
85
+ @my_params = {}
86
+ end
87
+
88
+ def set_some_params(*kwords_vals)
89
+ kwords_vals.each_slice(2) do |kword, val|
90
+ @my_params[kword] = val if text_dict.check(kword, val)
91
+ end
92
+ end
93
+ end
94
+
95
+ fig = MyFigure.new("It Came From Outer Space!")
96
+ fig.set_some_params(:fontsize, 11, :fontfamily, 'sans', :bold, true, :fontname, 'Georiga')
97
+ ```
98
+ How users treat validated or failed parameters from here is left to the imagination.
99
+
100
+ ***
101
+
102
+ ### Anatomy of a KwargModel:
103
+ #### Typedef and Struct
104
+
105
+ Each *typedef* is actually a method built to handle a particular kind of *struct*, while
106
+ each *struct* is what makes an instance of KwargModel unique. Some *typedefs* will
107
+ only allow for a specific set of *struct* values while others are more flexible. There are just
108
+ eight *typedef* methods, though you can easily make your own.
109
+
110
+ #### ***:typeof***
111
+ Your *struct* contains a singular value of exactly one datatype.
112
+
113
+ * ***structs*** - Some of Ruby's built-in types plus *Bool*, an added datatype for
114
+ true/false collectively. Acceptable *struct* arguments then, are: **Numeric, Float, Integer, Bool, String, Symbol**
115
+ * Can accept a Proc that must also return true for successful validation
116
+
117
+ ```ruby
118
+ my_dict[:example] = :typeof, Bool
119
+ my_dict.check(:example, false) # => true
120
+ my_dict.check(:example, true) # => true
121
+
122
+ my_dict[:proc_example] = :typeof, Float, Proc.new { |n| n > 5.3 }
123
+ my_dict.check(:proc_example, 2.1) # => false
124
+ my_dict.check(:proc_example, 5.4) # => true
125
+ my_dict.check(:proc_example, 6) # => false ... note that 6 > 5.3 but 6 is not datatype Float
126
+ ```
127
+ ***
128
+
129
+ #### ***:arrayof***
130
+ Your *struct* contains an array of any length but contains only one datatype.
131
+
132
+ * ***structs*** - Again some of Ruby's built-in types plus Bool: **Numeric, Float, Integer, Bool, String, Symbol**
133
+ * Multi-dimensional arrays will be treated as flattened and all values will still
134
+ be checked against the given *struct*
135
+ * Can accept a Proc that must return true for ALL values in the array.
136
+
137
+ ```ruby
138
+ my_dict[:example] = :arrayof, Strings
139
+ my_dict.check(:example, ['This', 'will', 'return', 'true']) # => true
140
+ my_dict.check(:example, ['This', 'is', 'false', 4.7]) # => false
141
+
142
+ my_dict[:proc_example] = :arrayof, Strings, Proc.new { |s| s.length > 2 }
143
+ my_dict.check(:proc_example, ['This', 'will', 'return', 'true']) # => true
144
+ my_dict.check(:proc_example, ['This', 'is', 'still', 'false']) # => false
145
+ ```
146
+ ***
147
+
148
+ #### ***:anyof***
149
+ Your *struct* contains a singular element that can be found in an array.
150
+
151
+ * ***structs*** - An array of any mix of things you'd like, EXCEPT other instances of KwargModels or KwargDicts.
152
+ * Will not accept a Proc and must not contain generic datatype symbols.
153
+
154
+ ```ruby
155
+ my_dict[:example] = :anyof, ['xx-small', 'x-small', 'large', 3.2]
156
+ my_dict.check(:example, 'x-small') # => true
157
+ my_dict.check(:example, 3.2) # => true
158
+ my_dict.check(:example, 'xx-large') # => false
159
+ ```
160
+ ***
161
+
162
+ #### ***:anyNof***
163
+ Your *struct* contains an element AND specific datatypes in an array.
164
+
165
+ * ***structs*** - An array of any mixed things you'd like plus generic datatype keywords **Numeric, Float, Integer, Bool, String, Symbol**
166
+ * Can accept a Proc that will only operate on a given value if it's identified by a generic datatype in *struct* after a check for explicit existence in the array
167
+
168
+ ```ruby
169
+ my_dict[:example] = :anyNof, [Integer, 'red', 'blue', 'magenta']
170
+ my_dict.check(:example, 'red') # => true
171
+ my_dict.check(:example, 34) # => true
172
+
173
+ my_dict[:proc_example] = :anyNof, [Float, 'green', 3.1], Proc.new { |n| n > 5 }
174
+ my_dict.check(:proc_example, 'green') # => true
175
+ my_dict.check(:proc_example, 6.1) # => true
176
+ my_dict.check(:proc_example, 3.1) # => true
177
+ # Again note that :anyNof's Proc is operating only on values NOT explicitly listed in the array.
178
+ ```
179
+ ***
180
+
181
+ #### ***:formof***
182
+ Your *struct* contains an array of exact length, you expect each element to be contained in a
183
+ specific order and be a generic datatype
184
+
185
+ * ***structs*** - An array of set length containing generic datatype keywords **Numeric, Float, Integer, Bool, String, Symbol**, in
186
+ a specific order. Will return false if user input appears out of order with respect
187
+ to the *struct*.
188
+ * Can accept a Proc that must return true for ALL values in the array.
189
+
190
+ ```ruby
191
+ my_dict[:example] = :formof, [Bool, Float, String]
192
+ my_dict.check(:example, [false, 3.1, "Holly Dolly"]) # => true
193
+ my_dict.check(:example, [false, 3.1]) # => false
194
+ my_dict.check(:example, ["Holly Dolly", 3.1, false]) # => false
195
+
196
+ my_dict[:proc_example] = :formof, [Integer, Float, Float], Proc.new { |n| n.between?(1, 3) }
197
+ my_dict.check(:proc_example, [2, 1.1, 1.2]) # => true
198
+ my_dict.check(:proc_example, [1.1, 2, 1.4]) # => false
199
+ ```
200
+
201
+ ***
202
+
203
+ #### ***:kwargsof***
204
+ Your *struct* contains a hash that corresponds to another KwargDict
205
+
206
+ * ***structs*** - Can only be another KwargDict instance.
207
+ * Will not accept a Proc
208
+ * Input hash need not contain every *kword* from the nested KwargDict to return true
209
+ * Will return true only if every key-arg pair in input hash is valid in nested KwargDict
210
+
211
+ ```ruby
212
+ another_dict.add([:one, :typeof, Float], [:two, :arrayof, String], [:three, :typeof, Bool],
213
+ [:and, :anyof, ['partridge', 'in', 'a', 'pear', 'tree']])
214
+
215
+ my_dict[:example] = :kwargsof, another_dict
216
+ my_dict.check(:example, {one:3.1, three:false, and:'in'}) # => true
217
+ my_dict.check(:example, {two:['this', 'works'], four:'without this'}) # => false
218
+ my_dict.check(:example, {two:['see?']}) # => true
219
+ ```
220
+ ***
221
+
222
+ #### ***:adv_formof***
223
+ Your *struct* contains an array of exact length, each of whom's elements has its own subset of
224
+ *typedef*, *struct*, and possibly *prc*
225
+
226
+ * ***structs*** - Must be an array of exact length, each element of which is a sub array
227
+ containing *typedef*, *struct*, and an optional *prc*, in that order. Can accept
228
+ **:typeof, :arrayof, :anyof, :anyNof, :formof**, and **:adv_formof**.
229
+ * Will NOT accept *:kwargsof* or *:and_kwargsof*.
230
+ * Will return false if user input appears out of order with respect to the *struct*.
231
+ * Will not accept a Proc outside of a sub *typedef*. Each element in *struct* may
232
+ have its own unique Proc, however, if allowed for that *typedef*.
233
+
234
+ ```ruby
235
+ my_dict[:example] = :adv_formof, [[:typeof, Float], [:arrayof, Integer]]
236
+ my_dict.check(:example, [3.1, [1, 2, 3, 4, 5]]) # => true
237
+ my_dict.check(:example, [3.1, ['1', '2', '3']]) # => false
238
+
239
+ my_dict[:proc_example] = :adv_formof, [[:typeof, String, Proc.new { |s| s.length > 5 }],
240
+ [:formof, [Float]*3 , Proc.new { |n| n.ibetween?(0,1) }]]
241
+ my_dict.check(:proc_example, ["Longer", [0.25, 0.5, 1.0]]) # => true
242
+ my_dict.check(:proc_example, ["Longer", [-0.25, 0.5, -1.0]]) # => false
243
+ my_dict.check(:proc_example, ["Short", [0.25, 0.5, 1.0]]) # => false
244
+ ```
245
+
246
+ ***
247
+
248
+ #### ***:and_kwargsof***
249
+ Your *struct* is structured like *:adv_formof* but the last element MUST be a *:kwargsof* *typedef*
250
+
251
+ * ***structs*** - MUST be an array in the form of *:adv_formof*, but the last sub *typedef* MUST
252
+ be *:kwargsof*
253
+ * Will return true if given a single value that returns true from the first sub *typedef* in the array.
254
+ * Will return true if given an array of values in the order they appear in *struct*, without skipping one, and each
255
+ returns true from its respective sub *typedef*
256
+ * Will return true if the previous statement is true but the given array also includes a hash that corresponds
257
+ to the last sub *typedef* in the *struct*, which again must always be *:kwargsof*.
258
+ * Will return false if only a hash is present, even if the hash elements are all valid to its
259
+ nested KwargDict
260
+ * Each sub *typedef* may receive a Proc if allowed for that *typedef*
261
+
262
+ ```ruby
263
+ another_dict.add([:one, :typeof, Float], [:two, :arrayof, String])
264
+ my_dict[:example] = :and_kwargsof, [[:typeof, String], [:typeof, Bool], [:kwargsof, another_dict]]
265
+
266
+ my_dict.check(:example, 'It works!') # => true
267
+ my_dict.check(:example, ['And this.']) # => true
268
+ my_dict.check(:example, ['This too.', true]) # => true
269
+ my_dict.check(:example, ['As does this.', false, {two:['Super!']}]) # => true
270
+ my_dict.check(:example, ['Even this works.', {two:['Yep.'], one:3.1}]) # => true
271
+
272
+ my_dict.check(:example, true) # => false | Skips the first element of :example
273
+ my_dict.check(:example, [true, 'It broke!']) # => false | Elements appear out of order
274
+ my_dict.check(:example, {one:'Nope'}) # => false | Contains only the hash
275
+ ```
276
+
277
+ ### ToDo:
278
+
279
+ * Add more examples.
280
+
281
+ * Modify the typedefs *:kwargsof* and *:and_kwargsof* to return a mapping of true
282
+ and false values. Write a method #granular_check into KwargDict to return
283
+ those arrays of Bools and re-write #check to return a singular Bool based on whether
284
+ any Bool in the array from #granular_check is false.
285
+
286
+ * Concerning the above, may re-rewrite those typedefs to return hashes of Bools,
287
+ which may make it even easier for the user to decide what to do with the returned
288
+ validation data.
289
+
290
+ * The RSPEC files do not yet check every detail of the KwargTypes as they should.
291
+
292
+ * Add another module that check's most aspects of a definition itself.
293
+ In other words, checking that the *struct* a user wishes to assign to a
294
+ definition in a KwargDict fits within the boundaries set by it's associated
295
+ *typedef*. No assigning the datatype keyword 'Array' to a *:typeof* model,
296
+ for instance.
297
+
298
+ * Better documentation?
299
+
300
+ * Build a method into KwargDict that allows the user to easily merge specific
301
+ entries from different dictionaries.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "yard"
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ YARD::Rake::YardocTask.new
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "kdict"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "pry"
14
+ Pry.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here