metastore 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +90 -4
  3. data/lib/metastore/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1abd762a9bf15920fe6a4fcb570da88fc6cdbb04
4
- data.tar.gz: fb006ace0d643e03012271353248d3b4bf224bf7
3
+ metadata.gz: 7cca3216af0666502760ad04279db43a9a8bc57f
4
+ data.tar.gz: 768a7cbf250acfd0b2d7f06e87606611d733aa23
5
5
  SHA512:
6
- metadata.gz: 60b555b170ad5cf1befcd75a379f256715a14b1e544c7518eaf6503bcd3b88b9b8829b79d0c1564a2712403455d2f69d2a7774533bf42b0e14c7245e09b0defd
7
- data.tar.gz: ae34d4a36e98d1bd3fb0b06f9fe815060f98c3ffbe5bf252c18e3abfbef05b7b3e3f6aa5f2401e2ec53890d657ae859966b5b750d84e6d5b4939d0f9364669fa
6
+ metadata.gz: f738de3d865b98b7b7df13bf4d0b9ec70fe561fa72fe845efc8cf67875799a9a311f2af21e27ec6a170410518d2180b8750c1a174329e6df6920b6a658ed1a37
7
+ data.tar.gz: 6354a19e99dc4e6aae63122cc77e84feef41ee5c3398c1e44be33fb3fa3e6546e6c21b496672e3f433869e511641fdb2082e52ab9aad610baadf847261859957
data/README.md CHANGED
@@ -25,17 +25,103 @@ Or install it yourself as:
25
25
 
26
26
  ## Usage
27
27
 
28
- TODO
28
+ There are four public methods hanging off `Metastore::Cabinet`:
29
29
 
30
- ## Development
30
+ * `#get('key')` or `<Metastore::Cabinet instance>['key']`
31
+ * `#set('key', 'value')` or `<Metastore::Cabinet instance>['key'] = 'value'`
32
+ * `#clear!`
33
+ * `#contents`
34
+
35
+ ### Setup
36
+
37
+ ```ruby
38
+ require 'metastore'
39
+
40
+ file = File.join(ENV['HOME'], '.metadata.yaml')
41
+ store = Metastore::Cabinet.new(file)
42
+ ```
43
+
44
+ ### Basic example
45
+
46
+ ```ruby
47
+ store.clear!
48
+ => true
49
+
50
+ store.contents
51
+ => {}
52
+
53
+ store.get('key')
54
+ => nil
55
+
56
+ store.set('key', 'value')
57
+ => true
58
+
59
+ store.contents
60
+ => {"key"=>"value"}
61
+
62
+ store.get('key')
63
+ => "value"
64
+ ```
65
+
66
+ ### Advanced examples
67
+
68
+ When setting values, you can nest both keys and values:
69
+
70
+ ```ruby
71
+ store.clear!
72
+ => true
31
73
 
32
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
74
+ store.contents
75
+ => {}
76
+
77
+ store.get('key1.key2')
78
+ => nil
79
+
80
+ store.set('key1.key2', 'key.key2.value')
81
+ => true
82
+
83
+ store.contents
84
+ => {"key1"=>{"key2"=>"key.key2.value"}}
85
+
86
+ store.set('key3.key4', { 'key' => 'value' })
87
+ => true
88
+
89
+ store.contents
90
+ => {"key1"=>{"key2"=>"key.key2.value"}, "key3"=>{"key4"=>{"key"=>"value"}}}
91
+ ```
92
+
93
+ You can also use Hash notation:
94
+
95
+ ```ruby
96
+ store.clear!
97
+ => true
98
+
99
+ store.contents
100
+ => {}
101
+
102
+ store['key1.key2']
103
+ => nil
104
+
105
+ store['key1.key2'] = 'key.key2.value'
106
+ => true
107
+
108
+ store.contents
109
+ => {"key1"=>{"key2"=>"key.key2.value"}}
110
+
111
+ store['key3.key4'] = { 'key' => 'value' }
112
+ => true
113
+
114
+ store.contents
115
+ => {"key1"=>{"key2"=>"key.key2.value"}, "key3"=>{"key4"=>{"key"=>"value"}}}
116
+ ```
117
+
118
+ ## Development
33
119
 
34
120
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
121
 
36
122
  ## Contributing
37
123
 
38
- 1. Fork it ( https://github.com/[my-github-username]/metastore/fork )
124
+ 1. Fork it ( https://github.com/ashmckenzie/metastore/fork )
39
125
  2. Create your feature branch (`git checkout -b my-new-feature`)
40
126
  3. Commit your changes (`git commit -am 'Add some feature'`)
41
127
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module Metastore
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metastore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash McKenzie