bootinq 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bootinq.rb +18 -0
- data/lib/bootinq/switch.rb +36 -0
- data/lib/bootinq/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02d532d3f79f581c02a9cf22de365c865a5fc455460ff5559d9f32893fc72daa
|
4
|
+
data.tar.gz: 274bbc9139607038551bd75d73104301a6d14a561dfe8a736d33c50fc91f473b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 424dd6941e25ad8b8b5a5497bf5ff5853bf66255774677e2831ca4972756b87956eb93ed55d3fcb87285ad2fc51c24279073c579fcea93a2ce36fa3689105d3d
|
7
|
+
data.tar.gz: 8b807c29dffd4a66ee89ce6b3790560fe0cf3aa69ee1ef1544ed87a5e32f3204077b981df613d05c22530952506a35fa275b86669965610760c025c13484785d
|
data/lib/bootinq.rb
CHANGED
@@ -4,6 +4,7 @@ require "yaml"
|
|
4
4
|
require "singleton"
|
5
5
|
require "forwardable"
|
6
6
|
require "bootinq/component"
|
7
|
+
require "bootinq/switch"
|
7
8
|
|
8
9
|
# = Bootinq
|
9
10
|
#
|
@@ -105,6 +106,7 @@ class Bootinq
|
|
105
106
|
@_neg = @_value.start_with?(?-, ?^)
|
106
107
|
@flags = []
|
107
108
|
@components = []
|
109
|
+
@switch = Switch.new(*@components)
|
108
110
|
|
109
111
|
config['parts'].each { |flag, name| enable_component(name, flag: flag) }
|
110
112
|
config['mount'].each { |flag, name| enable_component(name, flag: flag, as: Mountable) }
|
@@ -228,6 +230,22 @@ class Bootinq
|
|
228
230
|
is_matched
|
229
231
|
end
|
230
232
|
|
233
|
+
# :call-seq:
|
234
|
+
# Bottinq.switch(*parts) { block } -> nil
|
235
|
+
#
|
236
|
+
# Collector method.
|
237
|
+
#
|
238
|
+
# Example:
|
239
|
+
#
|
240
|
+
# Bootinq.switch do |part|
|
241
|
+
# part.frontend { … }
|
242
|
+
# part.backend { … }
|
243
|
+
# end
|
244
|
+
delegated def switch # :yields: Bootinq::Switch.new
|
245
|
+
yield(@switch)
|
246
|
+
nil
|
247
|
+
end
|
248
|
+
|
231
249
|
# Freezes every instance variables and the instance itself.
|
232
250
|
def freeze
|
233
251
|
@_value.freeze
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Bootinq
|
4
|
+
class Switch < ::BasicObject # :no-doc:
|
5
|
+
undef_method :==
|
6
|
+
undef_method :equal?
|
7
|
+
|
8
|
+
module YieldMixin
|
9
|
+
def yield_block
|
10
|
+
yield
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private_constant :YieldMixin
|
15
|
+
|
16
|
+
def self.new(*names)
|
17
|
+
switch = super()
|
18
|
+
mixin = ::Module.new
|
19
|
+
mixin.include(YieldMixin)
|
20
|
+
names.each { |name| mixin.alias_method name, :yield_block }
|
21
|
+
mixin.send(:private, :yield_block)
|
22
|
+
mixin.send(:extend_object, switch)
|
23
|
+
switch
|
24
|
+
ensure
|
25
|
+
mixin = nil
|
26
|
+
end
|
27
|
+
|
28
|
+
def raise(*args) # :no-doc:
|
29
|
+
::Object.send(:raise, *args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def method_missing(*)
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/bootinq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootinq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- lib/bootinq.rb
|
59
59
|
- lib/bootinq.yml
|
60
60
|
- lib/bootinq/component.rb
|
61
|
+
- lib/bootinq/switch.rb
|
61
62
|
- lib/bootinq/version.rb
|
62
63
|
homepage: https://github.com/estum/bootinq
|
63
64
|
licenses:
|
@@ -78,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
79
|
- !ruby/object:Gem::Version
|
79
80
|
version: '0'
|
80
81
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.7.6
|
82
|
+
rubygems_version: 3.0.3
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Rails Boot Inquirer
|