shard-container 0.9.0 → 0.9.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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/readme.md +80 -0
  3. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a59bf5f9976b99a94988d75ca6aefb3fffafdfd
4
- data.tar.gz: 29291c3ecc7ed92298999ebefd996f2ca6cca3e3
3
+ metadata.gz: 39680cb718fe011d2efb67e1d43e645daa8f0a79
4
+ data.tar.gz: 542fb5ddcc1a47877701b0bcba1f912afb9deb6c
5
5
  SHA512:
6
- metadata.gz: 5c0c3ae4d81fb11cdef585d4754e22344348c4a9e8fe6725721b38fa976b0cf347769a6713cf02876430762eb721f89bc5b2b9a5121ce607c1a0dd1da49c7afb
7
- data.tar.gz: 46c4b614f0a2c10a5a427d0560929288ca4a5978f3937a0c45156ff3a75e953bc359e80bfdbb87e1df7813489bfaa40d07de4d2e2d57aa6e9b5c8c8b73fe7518
6
+ metadata.gz: 54d9adbd76caf9f0adbc91f4d347a04583977298c29b5c628dfbc7c3e728a23835c544f471f249abd7b4992d3289e9218ac4e9aa39022326ad745b64589aacf1
7
+ data.tar.gz: 3b20d19356d1db86773bcd8b64b010e1b2c225deece4f7fdb9f7fcaf6ce6629b36c0fe44ddc3727ea063e854b01fd4f8e6b55a331211819b50dfd82629027097
data/readme.md ADDED
@@ -0,0 +1,80 @@
1
+ [![Gem Version](https://badge.fury.io/rb/shard-container.svg)](https://badge.fury.io/rb/shard-container)
2
+
3
+ # Shard
4
+
5
+ ## What is Shard?
6
+ > Shard is an intuitive container class that allows extended capabilities of Hashes and arrays, as well as extra methods for formatting and aliases.
7
+
8
+ ## Methods
9
+ > ##### Initialization
10
+ > A shard's initial parameters are the symbols that you can access via method calls (ex `Shard.values[0].name`) and can be set to any non-iterable. For ease of documenting my code, we'll just use key/val/util.
11
+
12
+ > ```ruby
13
+ > test1=Shard.new(key,val,util)
14
+ > ```
15
+
16
+ > ##### Inserting a new segment to a shard
17
+ > Adding to a shard can be done one of two ways.
18
+
19
+ > ```ruby
20
+ > test=Shard.new(:key,:val,:util) #initialize the shard
21
+ >
22
+ > test.insert(-1,'foo',:bar,123) #inserts at last position
23
+ > test.insert(0,'foo',:baz,123) #inserts at position 0
24
+ > test.values<<['foo',:bar,123] #this can be cleaned up later
25
+ > ```
26
+
27
+ > ##### Deleting shard elements
28
+ > Deleting from a shard is also easily done. The type parameter is automatically converted to a symbol, so it can be any non-iterable that matches an identifier.
29
+
30
+ > ```ruby
31
+ > test=Shard.new(:key,:val,:util) #initialize the shard
32
+ > test.add(-1,'foo',:bar,123) #add to the shard
33
+
34
+ > test.delete('key','foo') #delete by key
35
+ > test.delete(:val,':bar') #delete by value
36
+ > test.delete(false,0,2) #delete everything from position 0 to 2
37
+ > test.delete(:util,123,0,2) #delete all utils that match 123 from position 0 to 2
38
+ ```
39
+
40
+ > ##### Correction
41
+ > Shards also supply a few formatting methods.
42
+
43
+ > ```ruby
44
+ test=Shard.new(:key,:val,:util) #initialize the shard
45
+ x.values<<[1,2,3] #add to the shard manually
46
+ => [[1, 2, 3]]
47
+ test.corr #convert all manually inserted array to formatted Dict2 Structs
48
+ => [#<struct key=1, val=2, util=3>]
49
+ ```
50
+
51
+ > ##### Pruning
52
+ > Pruning a shard down to its unique identifiers is accomplished using the following aliases, or a raw `Shard.prune` method call using any combination of the shard identifiers.
53
+
54
+ > ```ruby
55
+ Shard.pAll #prune all
56
+ Shard.pruneAll #alias for pAll
57
+ Shard.prune(:key,:val) #prune both keys and values
58
+ ```
59
+
60
+ > ##### Cleaning shards
61
+ > Cleaning a shard using the `.clean` method returns an Array (nested, if more than one set is selected) of readable sets with all elements in their original types.
62
+ >```ruby
63
+ Shard.clean #cleans and returns entire shard
64
+ Shard.clean(0) #cleans and returns shard element at index 0
65
+ Shard.clean(0,2) #cleans and returns shard elements at indexes 0 to 2
66
+ ```
67
+
68
+ > ##### Listing
69
+ > Listing shard elements is done with the `.list` method, like so
70
+ > ```ruby
71
+ Shard.list(:key,0,2) #returns all keys between index 0 and 2
72
+ Shard.listPos(:key,0) #returns the key at index 0
73
+ ```
74
+
75
+ > ##### Meta tags
76
+ > Getting a shard's meta information is done with the following methods or aliases
77
+ > ```ruby
78
+ Shard.meta.all #return a Hash of all meta tags
79
+ Shard.meta.[metatag] #return the supplied metatag's value (can be size, is_empty, num_indentifiers, identifiers, creationStamp, or editStamp)
80
+ ```
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shard-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ao
@@ -15,12 +15,14 @@ description: An intuitive new container class for everyone from the everyday pro
15
15
  email:
16
16
  executables: []
17
17
  extensions: []
18
- extra_rdoc_files: []
18
+ extra_rdoc_files:
19
+ - readme.md
19
20
  files:
20
21
  - lib/shard.rb
21
22
  - lib/shard/core.rb
22
23
  - lib/shard/formatting.rb
23
24
  - lib/shard/util.rb
25
+ - readme.md
24
26
  homepage: https://github.com/Ao-san/Shard
25
27
  licenses:
26
28
  - MIT