metastore 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -4
- data/lib/metastore/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cca3216af0666502760ad04279db43a9a8bc57f
|
4
|
+
data.tar.gz: 768a7cbf250acfd0b2d7f06e87606611d733aa23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
28
|
+
There are four public methods hanging off `Metastore::Cabinet`:
|
29
29
|
|
30
|
-
|
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
|
-
|
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/
|
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`)
|
data/lib/metastore/version.rb
CHANGED