magic_data 1.0.3 → 1.0.4

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
  SHA1:
3
- metadata.gz: 07fc168b160164df4b4d1ecce134e2e531a52a12
4
- data.tar.gz: 222479db7900fdb52d534be386ecd384fa6b68c0
3
+ metadata.gz: 0cd4d87961452dae777da459bc745cb08d213de9
4
+ data.tar.gz: e19f9b84f0f57f9e8a9f2fe6a2056f9f7d06c8a7
5
5
  SHA512:
6
- metadata.gz: 43f8d72b688e22c9b569a738dfd09bb52461e32f7dcef9cace94ec7c799a31ebee42dee2e9815231efa34cd860c1ae31617f4da3472ff732d7ba8b3c78dcb1bd
7
- data.tar.gz: fbe8a28ccd446ba41ece25a9c556d2e055e4dfde93025f360ab3a277dace409488c70c3619c6b4f1d00e50204c243c66e868ee07717f96c48486351695901bb7
6
+ metadata.gz: b5bca7504cf9d2b8c188b1f8d125d53e406908f84da4a3c44ea19de10164a5722663b662b1118d8fb1f8638fee756fc7f99256a18c937975f0999031ea5f1c2f
7
+ data.tar.gz: a2d92a264b4f27358a065bd19f2a6595b36cccbcd2ff43e52778af41d696a3c46ed1c48ea14970114754c2b4e15232655302498779a832b8e4c81f6547bf551a
data/README.md CHANGED
@@ -13,12 +13,14 @@ gem 'magic_data'
13
13
  ## Usage
14
14
 
15
15
  ##### Creating generators with a block
16
+ Input keys can be strings or symbols, you decide!
16
17
  ```ruby
17
18
  MagicData.set('~username') {rand(36**10).to_s(36) << '.51d281ef@mailosaur.io'}
18
- MagicData.set('~password') {rand(36**10).to_s(36)}
19
+ MagicData.set(:password) {rand(36**10).to_s(36)}
19
20
  ```
20
21
 
21
22
  ##### Creating generators with a static value
23
+ Input values will be converted to a string for retrieval.
22
24
  ```ruby
23
25
  MagicData.set('~existing_username', 'tk8817@test.com')
24
26
  MagicData.set('~existing_username', FigNewton.existing_password) #example uses Cheezy's FigNewton lib
@@ -30,19 +32,23 @@ This will return a value generated from the block provided during creation
30
32
  MagicData.get('~username')
31
33
  # => ch3jdb68sjhnss21.51d281ef@mailosaur.io
32
34
 
33
- MagicData.get('~username')
34
- # => h4dnsah28s2hs27hd3.51d281ef@mailosaur.io
35
+ MagicData.get(:password)
36
+ # => h4dnsah28s2hs27hd3
35
37
  ```
36
38
 
37
39
  ##### Retrieving latest block generated value
40
+ Non existent values will return as nil
38
41
  ```ruby
39
- MagicData.get_latest('~username')
40
- # => h4dnsah28s2hs27hd3.51d281ef@mailosaur.io
42
+ MagicData.get_latest(:password)
43
+ # => h4dnsah28s2hs27hd3
44
+
45
+ MagicData.get_latest('not_real')
46
+ # => nil
41
47
  ```
42
48
 
43
49
  ##### Modifying hash with magic_data (return full hash)
44
50
  ```ruby
45
- input = {user_login: '~username', user_password: '~password', user_phone: '555-555-5555'}
51
+ input = {user_login: '~username', :user_password => :password, user_phone: '555-555-5555'}
46
52
  MagicData.process(input)
47
53
  # => {user_login: 'vb39hsb2s.51d281ef@mailosaur.io', user_password: '9fj4h3hnssoqlks', user_phone: '555-555-5555'}
48
54
  ```
@@ -21,7 +21,7 @@ class MagicData
21
21
  end
22
22
 
23
23
  def get(key)
24
- @magic[key].call
24
+ @saved["latest_#{key}"]= @magic[key].call
25
25
  end
26
26
 
27
27
  def get_latest(key)
data/magic_data.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'magic_data'
7
- spec.version = '1.0.3'
7
+ spec.version = '1.0.4'
8
8
  spec.authors = ['Justin Commu']
9
9
  spec.email = ['Justin.Commu@loblaw.ca']
10
10
  spec.summary = 'Dynamic data library for Ruby.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Commu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-29 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: magic_data allows a user to setup dynamic keys at runtime and lets them
14
14
  retrieve the most recently generated value
@@ -50,4 +50,3 @@ signing_key:
50
50
  specification_version: 4
51
51
  summary: Dynamic data library for Ruby.
52
52
  test_files: []
53
- has_rdoc: