orthoses 0.11.0 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bbebf8271fbe9859e0e322e0e2d12fbf7a03dc30663309771edeba678674679
4
- data.tar.gz: bfdfabbb3110a7c159a7763463077768d76b9cfd14ae77537a87d0abbd8fda74
3
+ metadata.gz: b99546cf07198d891673d96f57a8cd22602db3442fc8526377e113dc82716351
4
+ data.tar.gz: 45d4d49fd66765eac0429d90718ae7b4bc3f66181f67efd97c9f4a5b4e970955
5
5
  SHA512:
6
- metadata.gz: e1093d5bbc23bf0577d915afd70fa34907316bcdd2062e34cdc7506f455636e47e02bb046048e4682c16feeba2bc045985fbae2636bd2e220fc90a66f30e957b
7
- data.tar.gz: 84fe1da94bfe208b46ddc1b3607ba7962e1133150fe454ffc8d4e40ca0dd6bc99c4b7e24f41a18f0217913eedd6e5b08e45329d07455e1e5fb913d102c13b67e
6
+ metadata.gz: e4d4ebe91a584ab50850ccdf60a489e37fe1c4da99fd8bc9ed2f8aa255b2e35f5b60b0b3ab5f2662833d34f8514f87be84018b17a97dcda76db4e57e1f52a834
7
+ data.tar.gz: 78696a4162f7e469c52e059cf4fdc09160926f354ab5b3343db681d7ba78360c1406889da81830c585dda30a95921d9753fced392ad92f72324f27a8d0ad3747
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orthoses (0.11.0)
4
+ orthoses (1.0.0)
5
5
  rbs (~> 2.0)
6
6
 
7
7
  GEM
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
- if: -> (name, _content) {
29
- path, _lineno = Object.const_source_location(name)
30
- return false unless path
31
- %r{app/models}.match?(path)
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
@@ -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, if: ->(name, content) {
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){
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Orthoses
4
4
  class Constant
5
- def initialize(loader, strict:, if: nil, on_error: nil)
5
+ def initialize(loader, strict: false, if: nil, on_error: nil)
6
6
  @loader = loader
7
7
  @strict = strict
8
8
  @if = binding.local_variable_get(:if)
@@ -2,19 +2,21 @@
2
2
 
3
3
  module Orthoses
4
4
  # Filter current store.
5
- # use Orthoses::Filter,
6
- # # filter stored key and value if proc return true
7
- # if: -> (name, content) { Orthoses.rbs_defined_class?(name) }
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
- @if.call(name, content).tap do
19
+ @block.call(name, content).tap do
18
20
  Orthoses.logger.debug("Filter pass [#{name}]")
19
21
  end
20
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orthoses
4
- VERSION = "0.11.0"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -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
@@ -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, if: ^(String, Orthoses::Content) -> boolish) -> void
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
@@ -1,7 +1,7 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  module Orthoses
4
- VERSION: "0.11.0"
4
+ VERSION: "1.0.0"
5
5
  attr_accessor self.logger: ::Logger
6
6
  type store = Hash[String, Orthoses::Content]
7
7
  INSTANCE_METHOD_METHOD: UnboundMethod
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.11.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-08-27 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs