orthoses 0.11.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -6
- data/examples/minitest/Rakefile +2 -2
- data/lib/orthoses/constant.rb +1 -1
- data/lib/orthoses/filter.rb +7 -5
- data/lib/orthoses/version.rb +1 -1
- data/sig/orthoses/constant.rbs +1 -1
- data/sig/orthoses/filter.rbs +2 -1
- data/sig/orthoses.rbs +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b99546cf07198d891673d96f57a8cd22602db3442fc8526377e113dc82716351
|
4
|
+
data.tar.gz: 45d4d49fd66765eac0429d90718ae7b4bc3f66181f67efd97c9f4a5b4e970955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d4ebe91a584ab50850ccdf60a489e37fe1c4da99fd8bc9ed2f8aa255b2e35f5b60b0b3ab5f2662833d34f8514f87be84018b17a97dcda76db4e57e1f52a834
|
7
|
+
data.tar.gz: 78696a4162f7e469c52e059cf4fdc09160926f354ab5b3343db681d7ba78360c1406889da81830c585dda30a95921d9753fced392ad92f72324f27a8d0ad3747
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,12 +24,11 @@ Orthoses::Builder.new do
|
|
24
24
|
use Orthoses::CreateFileByName
|
25
25
|
base_dir: Rails.root.join("sig/out"),
|
26
26
|
header: "# !!! GENERATED CODE !!!"
|
27
|
-
use Orthoses::Filter,
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
27
|
+
use Orthoses::Filter do |name, _content|
|
28
|
+
path, _lineno = Object.const_source_location(name)
|
29
|
+
return false unless path
|
30
|
+
%r{app/models}.match?(path)
|
31
|
+
end
|
33
32
|
use YourCustom::Middleware
|
34
33
|
use Orthoses::Mixin
|
35
34
|
use Orthoses::Constant
|
data/examples/minitest/Rakefile
CHANGED
@@ -13,9 +13,9 @@ task :minitest => :src do
|
|
13
13
|
Orthoses::Builder.new do
|
14
14
|
use Orthoses::CreateFileByName,
|
15
15
|
base_dir: out.to_s
|
16
|
-
use Orthoses::Filter
|
16
|
+
use Orthoses::Filter do |name, content|
|
17
17
|
name.start_with?("Minitest") || name == "Kernel"
|
18
|
-
|
18
|
+
end
|
19
19
|
use Orthoses::Constant,
|
20
20
|
strict: false,
|
21
21
|
if: ->(current, const, val, rbs){
|
data/lib/orthoses/constant.rb
CHANGED
data/lib/orthoses/filter.rb
CHANGED
@@ -2,19 +2,21 @@
|
|
2
2
|
|
3
3
|
module Orthoses
|
4
4
|
# Filter current store.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# filter stored key and value if proc return true
|
6
|
+
# use Orthoses::Filter do |name, content|
|
7
|
+
# Orthoses.rbs_defined_class?(name)
|
8
|
+
# end
|
8
9
|
class Filter
|
9
|
-
def initialize(loader, if:)
|
10
|
+
def initialize(loader, if: nil, &block)
|
10
11
|
@loader = loader
|
11
12
|
@if = binding.local_variable_get(:if)
|
13
|
+
@block = block || @if || raise(ArgumentError, "should give a block")
|
12
14
|
end
|
13
15
|
|
14
16
|
def call
|
15
17
|
@loader.call.tap do |store|
|
16
18
|
store.filter! do |name, content|
|
17
|
-
@
|
19
|
+
@block.call(name, content).tap do
|
18
20
|
Orthoses.logger.debug("Filter pass [#{name}]")
|
19
21
|
end
|
20
22
|
end
|
data/lib/orthoses/version.rb
CHANGED
data/sig/orthoses/constant.rbs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Constant
|
4
|
-
def initialize: (Orthoses::_Call loader, strict: bool, ?if: ^(Module, Symbol, untyped) -> boolish, ?on_error: ^(Orthoses::ConstLoadError) -> void) -> void
|
4
|
+
def initialize: (Orthoses::_Call loader, ?strict: bool, ?if: ^(Module, Symbol, untyped) -> boolish | nil, ?on_error: ^(Orthoses::ConstLoadError) -> void | nil) -> void
|
5
5
|
def call: () -> Orthoses::store
|
6
6
|
@loader: Orthoses::_Call
|
7
7
|
@strict: bool
|
data/sig/orthoses/filter.rbs
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Filter
|
4
|
-
def initialize: (Orthoses::_Call loader
|
4
|
+
def initialize: (Orthoses::_Call loader) { (String, Orthoses::Content) -> boolish } -> void
|
5
5
|
def call: () -> Orthoses::store
|
6
6
|
@loader: Orthoses::_Call
|
7
|
+
@block: ^(String, Orthoses::Content) -> boolish
|
7
8
|
end
|
data/sig/orthoses.rbs
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthoses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|