vv 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +29 -18
- data/lib/vv/object_methods.rb +100 -0
- data/lib/vv/utility/automate.rb +5 -2
- data/lib/vv/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef165dfa8e3762363a3bd8d5ae76110be98202cb892d83c71953014731d6b4f2
|
4
|
+
data.tar.gz: 720dbb648479c04ed011485530e103a20ac9a5bf3fbe4549b215ab9c61bfdae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d91c39035d18ea8be1624da47450bdd1008e6ba9fc426d96ef91dc1b8f6a5b03a465edae3eeec76c9e92546e00501e4497ff40b05c3e93296befe8b69c4df97e
|
7
|
+
data.tar.gz: 81283f1f1241a866781c660a35ee3a1837e1bd082c632d7f405582b984d577e2ddf61cf55c3ea2b7aa56ed8388c5801a5a11174518fa025d267a32eb5d6959da
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,33 @@
|
|
1
|
-
Copyright (c) 2018 Zach Aysan
|
1
|
+
Copyright (c) 2018–2019 Zach Aysan
|
2
2
|
|
3
|
-
|
3
|
+
Social Contract License (Alpha)
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any
|
6
|
-
a copy of this software and associated
|
7
|
-
"Software"), to deal in the
|
8
|
-
|
9
|
-
distribute,
|
10
|
-
permit persons to whom the Software is
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any entity
|
6
|
+
obtaining a copy of this software and associated
|
7
|
+
documentation files (the "Software"), to deal in the
|
8
|
+
Software, including the rights to use, copy, modify, merge,
|
9
|
+
publish, distribute, sub-license, and/or sell copies of the
|
10
|
+
Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
12
|
|
13
|
-
The above copyright notice and this permission notice
|
14
|
-
included in all copies or substantial portions of
|
13
|
+
1. The above copyright notice and this permission notice
|
14
|
+
shall be included in all copies or substantial portions of
|
15
|
+
the Software.
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
2. All entities benefiting from the Software must not be or
|
18
|
+
be owned by any entity that is in any part owned by a
|
19
|
+
billionaire; including stock, options, convertible debt,
|
20
|
+
derivatives or otherwise. For exemption from this license or
|
21
|
+
for clarification contact Zach Aysan by email. Most startups
|
22
|
+
or small businesses meet this license. At this time, no
|
23
|
+
known publicly traded companies do. This library must be
|
24
|
+
removed in the event that this is expected to change.
|
25
|
+
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
27
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
28
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
29
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
30
|
+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
31
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
32
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
33
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/vv/object_methods.rb
CHANGED
@@ -4,6 +4,69 @@ module VV
|
|
4
4
|
|
5
5
|
alias_method :responds_to?, :respond_to?
|
6
6
|
|
7
|
+
def consider input, &block
|
8
|
+
@__vv_consideration_dismissed_level ||= false
|
9
|
+
|
10
|
+
# For a potential parent consideration
|
11
|
+
return if self._consideration_dismissed?
|
12
|
+
|
13
|
+
@__vv_consideration_others ||= Hash.new
|
14
|
+
@__vv_consideration_level ||= -1
|
15
|
+
@__vv_consideration_level += 1
|
16
|
+
|
17
|
+
@__vv_considerations ||= Array.new
|
18
|
+
@__vv_considerations << input
|
19
|
+
yield
|
20
|
+
ensure
|
21
|
+
if @__vv_consideration_dismissed_level == \
|
22
|
+
@__vv_consideration_level
|
23
|
+
remove_instance_variable :@__vv_consideration_dismissed_level
|
24
|
+
end
|
25
|
+
|
26
|
+
@__vv_consideration_level -= 1
|
27
|
+
if @__vv_consideration_level < 0
|
28
|
+
remove_instance_variable :@__vv_consideration_level
|
29
|
+
remove_instance_variable :@__vv_consideration_others
|
30
|
+
end
|
31
|
+
@__vv_considerations.pop
|
32
|
+
unless @__vv_considerations.any?
|
33
|
+
remove_instance_variable :@__vv_considerations
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def given potential_match
|
38
|
+
return if self._consideration_dismissed?
|
39
|
+
return unless potential_match == self._consideration
|
40
|
+
|
41
|
+
response = yield
|
42
|
+
self._dismiss_consideration
|
43
|
+
response
|
44
|
+
end
|
45
|
+
|
46
|
+
def within potential_enum
|
47
|
+
return if self._consideration_dismissed?
|
48
|
+
|
49
|
+
return unless potential_enum.include? self._consideration
|
50
|
+
response = yield
|
51
|
+
self._dismiss_consideration
|
52
|
+
response
|
53
|
+
end
|
54
|
+
|
55
|
+
def otherwise
|
56
|
+
self._ensure_consideration_level!
|
57
|
+
|
58
|
+
level = @__vv_consideration_level
|
59
|
+
message = "Multiple otherwise methods in consideration."
|
60
|
+
fail message if @__vv_consideration_others[level]
|
61
|
+
@__vv_consideration_others[level] = true
|
62
|
+
|
63
|
+
return if self._consideration_dismissed?
|
64
|
+
|
65
|
+
response = yield
|
66
|
+
self._dismiss_consideration
|
67
|
+
response
|
68
|
+
end
|
69
|
+
|
7
70
|
def set_attrs_via( *attributes, document: )
|
8
71
|
attributes.flatten!
|
9
72
|
document.keys.to_set.includes_all! attributes
|
@@ -71,5 +134,42 @@ module VV
|
|
71
134
|
end
|
72
135
|
alias_method :must_be_a!, :is_a!
|
73
136
|
|
137
|
+
def _dismiss_consideration
|
138
|
+
self._ensure_consideration_level!
|
139
|
+
@__vv_consideration_dismissed_level = \
|
140
|
+
@__vv_consideration_level
|
141
|
+
end
|
142
|
+
|
143
|
+
def _consideration_dismissed?
|
144
|
+
defined = \
|
145
|
+
instance_variable_defined?("@__vv_consideration_dismissed_level")
|
146
|
+
|
147
|
+
message = \
|
148
|
+
"Assertion failure: @__vv_consideration_dismissed_level not defined"
|
149
|
+
fail message unless defined
|
150
|
+
|
151
|
+
!! @__vv_consideration_dismissed_level
|
152
|
+
end
|
153
|
+
|
154
|
+
def _ensure_consideration_level!
|
155
|
+
defined = instance_variable_defined?("@__vv_considerations")
|
156
|
+
fail "No current consideration active" unless defined
|
157
|
+
|
158
|
+
defined = instance_variable_defined?("@__vv_consideration_level")
|
159
|
+
message = "Assertion failure: Consideration level not set"
|
160
|
+
fail message unless defined
|
161
|
+
|
162
|
+
message = \
|
163
|
+
"Assertion failure: Consideration level mismatch."
|
164
|
+
size = @__vv_considerations.size
|
165
|
+
level_ok = size == ( @__vv_consideration_level + 1 )
|
166
|
+
fail message unless level_ok
|
167
|
+
end
|
168
|
+
|
169
|
+
def _consideration
|
170
|
+
self._ensure_consideration_level!
|
171
|
+
@__vv_considerations.last
|
172
|
+
end
|
173
|
+
|
74
174
|
end
|
75
175
|
end
|
data/lib/vv/utility/automate.rb
CHANGED
@@ -11,7 +11,10 @@ module VV
|
|
11
11
|
lines = File.read(path).split("\n")
|
12
12
|
|
13
13
|
raise "Unknown number of arguments" if args.size > 1
|
14
|
-
|
14
|
+
|
15
|
+
version_line_index = \
|
16
|
+
lines.find_index { |line| line.start_with? " VERSION" }
|
17
|
+
version = lines[version_line_index].split(" = ")[-1].gsub("'","")
|
15
18
|
if args.size < 1
|
16
19
|
puts version
|
17
20
|
exit
|
@@ -57,7 +60,7 @@ module VV
|
|
57
60
|
end
|
58
61
|
|
59
62
|
new_version = [major, minor, point].join(".")
|
60
|
-
lines[
|
63
|
+
lines[version_line_index] = " VERSION = '#{new_version}'"
|
61
64
|
lines << ""
|
62
65
|
|
63
66
|
File.write(path, lines.join("\n"))
|
data/lib/vv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Aysan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -92,7 +92,7 @@ files:
|
|
92
92
|
- lib/vv/version.rb
|
93
93
|
homepage: https://github.com/zachaysan/vv
|
94
94
|
licenses:
|
95
|
-
-
|
95
|
+
- Social Contract License (Alpha)
|
96
96
|
metadata: {}
|
97
97
|
post_install_message:
|
98
98
|
rdoc_options: []
|