magic_data 0.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c06b47ed121dd9785eb4b2ea52869ea9f66dd734
4
+ data.tar.gz: d43365f08337cafd80223a403268931002d9b8ce
5
+ SHA512:
6
+ metadata.gz: 50bcc64219638185c134cc12efd1bf78fb02f8c0dc60eed9a0782fd0f84f6b3357013833d812625bfd680b9f80a09ee533e13b20546aecaad864cb884e2d794f
7
+ data.tar.gz: a4385ce1e422565f6f71784246c2e845a41e6aa88c40de591a266189e2cc009530162aee3c701e23e050a13b8d9a1ee903a5b959ba112245aebab3a7fafbb4b5
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ magic_data (0.0.1)
5
+ magic_logger (~> 0.0, >= 0.0.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ magic_logger (0.0.2)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ magic_data!
17
+
18
+ BUNDLED WITH
19
+ 1.11.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT LICENSE
2
+
3
+ Copyright (c) Justin Commu <Justin.Commu@loblaw.ca>
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,31 @@
1
+ # WebTest
2
+
3
+ Welcome to Collector!
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'magic_data'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install magic_data
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+
28
+ ## License
29
+
30
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
31
+
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require 'magic_logger'
4
+
5
+ class MagicData
6
+
7
+ @magic={}
8
+ @saved={}
9
+
10
+ class << self
11
+
12
+ def form(fields)
13
+ modified = {}
14
+ fields.each do |key, value|
15
+ @saved["latest_#{value}"]= modified[key] = @magic[value].call if @magic.key?(value)
16
+ modified[key] = @saved[value] if @saved.key?(value)
17
+ end
18
+ Collector.log('magic_data', modified)
19
+ fields.merge(modified)
20
+ end
21
+
22
+ def set(key, value = nil, &block)
23
+ @magic[key] = block_given? ? block : lambda { "#{value}" }
24
+ end
25
+
26
+ def retrieve(key)
27
+ @magic[key].call
28
+ end
29
+
30
+ def latest(key)
31
+ @saved["latest_#{key}"]
32
+ end
33
+
34
+ end
35
+ end
36
+
37
+
@@ -0,0 +1,3 @@
1
+ module Version
2
+ VERSION = "0.0.1"
3
+ end
data/lib/magic_data.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'magic_data/magic_data'
2
+ require 'magic_data/version'
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'magic_data/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'magic_data'
8
+ spec.version = Version::VERSION
9
+ spec.authors = ['Justin Commu']
10
+ spec.email = ['Justin.Commu@loblaw.ca']
11
+ spec.summary = 'Dynamic data library for Ruby.'
12
+ spec.description = 'magic_data allows a user to setup dynamic keys at runtime and lets them retrieve the most recently generated value'
13
+ spec.homepage = 'https://loblawdigital.ca'
14
+ spec.license = 'MIT'
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = 'exe'
17
+ spec.platform = Gem::Platform::RUBY
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_runtime_dependency 'magic_logger', '~> 0.0', '>= 0.0.2'
22
+ end
23
+
24
+
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: magic_data
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin Commu
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: magic_logger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.0.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.0.2
33
+ description: magic_data allows a user to setup dynamic keys at runtime and lets them
34
+ retrieve the most recently generated value
35
+ email:
36
+ - Justin.Commu@loblaw.ca
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - ".gitignore"
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - LICENSE
45
+ - README.md
46
+ - lib/magic_data.rb
47
+ - lib/magic_data/magic_data.rb
48
+ - lib/magic_data/version.rb
49
+ - magic_data.gemspec
50
+ homepage: https://loblawdigital.ca
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.5.1
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Dynamic data library for Ruby.
74
+ test_files: []
75
+ has_rdoc: