persisted_hash 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/persisted_hash +32 -0
- data/lib/persisted_hash.rb +23 -0
- data/lib/version.rb +3 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c767614f941334405a8ad3b06223dceb80318b17
|
4
|
+
data.tar.gz: f120690ab1bbe43a740b41f4cc280a223f9ad302
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a9fea5a4481ef9b4630abfce3ebb3f4a4207fef9b4be85a2c55d78541c6f38f2a61f20bceb3174689112d5477c2cc39b8769ab7ce0a64cdc896ae8650fed62cc
|
7
|
+
data.tar.gz: befbae3a1c0b12fff26eeec014ca6bedc01d009d72d672edb3da8481e689ce26d71ff12f67a515539ed311ef0ffab0bf6a7be22b2a873a52d160b5ee8b71ae94
|
data/bin/persisted_hash
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'persisted_hash'
|
3
|
+
class PersistedHash::CLI < Thor
|
4
|
+
|
5
|
+
desc "global_patch_test", "global_patch_test"
|
6
|
+
def global_patch_test
|
7
|
+
Hash.include PersistedHash
|
8
|
+
db = {}.persisted "testdb.yaml"
|
9
|
+
db.set(:foo, :bar, 1)
|
10
|
+
puts "set nested key: #{db.get(:foo, :bar)}"
|
11
|
+
puts "here is entire hash: #{db.data}"
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "refinement_test", "refinement_test"
|
15
|
+
def refinement_test
|
16
|
+
Tester.refinement_test
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
module Tester
|
22
|
+
using PersistedHash
|
23
|
+
def self.refinement_test
|
24
|
+
db = {}.persisted "testdb.yaml"
|
25
|
+
db.set(:foo, :bar, 1)
|
26
|
+
puts "set nested key: #{db.get(:foo, :bar)}"
|
27
|
+
puts "here is entire hash: #{db.data}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
PersistedHash::CLI.start ARGV
|
32
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'colored'
|
2
|
+
require 'pry'
|
3
|
+
require 'active_support/all'
|
4
|
+
require 'thor'
|
5
|
+
require 'gemmy'
|
6
|
+
|
7
|
+
module PersistedHash
|
8
|
+
|
9
|
+
using Gemmy.patch("hash/i/persisted")
|
10
|
+
|
11
|
+
def self.persisted_hash(hash, *args)
|
12
|
+
hash.persisted *args
|
13
|
+
end
|
14
|
+
|
15
|
+
def persisted(*args)
|
16
|
+
PersistedHash.persisted_hash self, *args
|
17
|
+
end
|
18
|
+
|
19
|
+
refine Hash do
|
20
|
+
include PersistedHash
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: persisted_hash
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- maxpleaner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colored
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gemmyrb
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: ''
|
84
|
+
email: maxpleaner@gmail.com
|
85
|
+
executables:
|
86
|
+
- persisted_hash
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- bin/persisted_hash
|
91
|
+
- lib/persisted_hash.rb
|
92
|
+
- lib/version.rb
|
93
|
+
homepage: http://github.com/maxpleaner/gemmy
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '2.3'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.5.1
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.5.1
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: patch to Hash class to persist to YAML file
|
117
|
+
test_files: []
|