rbs_active_hash 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -19
- data/lib/generators/rbs_active_hash/install_generator.rb +3 -1
- data/lib/rbs_active_hash/active_hash.rb +11 -5
- data/lib/rbs_active_hash/version.rb +1 -1
- data/rbs_active_hash.gemspec +0 -1
- data/rbs_collection.lock.yaml +1 -5
- data/sig/rbs_active_hash/active_hash/parser.rbs +1 -1
- data/sig/rbs_active_hash/active_hash.rbs +2 -1
- data/sig/rbs_active_hash/rake_task.rbs +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49a4b12af2d15a13a338e2924494f4da8d3167301f3fa9bc66277bdf0185d326
|
4
|
+
data.tar.gz: 94eef0c6aafc8d0162541e51871ace002bdcd5b6f38f0203ef30eecfb19d666a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc036b3bd3ce01452800e183f683e6dc7a6c720d07484414c5c6cc393f9b7b8d15cef8d3819ef1ef38173b449b9cfdd892db3764e0f5468e76461f35ef557c0
|
7
|
+
data.tar.gz: 437b7dec163d2a770d2f916727aac06e3b1c6d2d69cae56cc1c63d756fa87b4abb12025f1b9ee9d833ccca00677bca70e062321ce8cd911fbb2f37a5ddfcca67
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,34 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs_active_hash (1.3.
|
4
|
+
rbs_active_hash (1.3.1)
|
5
5
|
active_hash
|
6
6
|
rbs
|
7
|
-
rbs_rails
|
8
7
|
|
9
8
|
GEM
|
10
9
|
remote: https://rubygems.org/
|
11
10
|
specs:
|
12
|
-
actionpack (7.0.7)
|
13
|
-
actionview (= 7.0.7)
|
14
|
-
activesupport (= 7.0.7)
|
11
|
+
actionpack (7.0.7.2)
|
12
|
+
actionview (= 7.0.7.2)
|
13
|
+
activesupport (= 7.0.7.2)
|
15
14
|
rack (~> 2.0, >= 2.2.4)
|
16
15
|
rack-test (>= 0.6.3)
|
17
16
|
rails-dom-testing (~> 2.0)
|
18
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
19
|
-
actionview (7.0.7)
|
20
|
-
activesupport (= 7.0.7)
|
18
|
+
actionview (7.0.7.2)
|
19
|
+
activesupport (= 7.0.7.2)
|
21
20
|
builder (~> 3.1)
|
22
21
|
erubi (~> 1.4)
|
23
22
|
rails-dom-testing (~> 2.0)
|
24
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
25
24
|
active_hash (3.2.0)
|
26
25
|
activesupport (>= 5.0.0)
|
27
|
-
activemodel (7.0.7)
|
28
|
-
activesupport (= 7.0.7)
|
29
|
-
activerecord (7.0.7)
|
30
|
-
activemodel (= 7.0.7)
|
31
|
-
activesupport (= 7.0.7)
|
32
|
-
activesupport (7.0.7)
|
26
|
+
activemodel (7.0.7.2)
|
27
|
+
activesupport (= 7.0.7.2)
|
28
|
+
activerecord (7.0.7.2)
|
29
|
+
activemodel (= 7.0.7.2)
|
30
|
+
activesupport (= 7.0.7.2)
|
31
|
+
activesupport (7.0.7.2)
|
33
32
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
33
|
i18n (>= 1.6, < 2)
|
35
34
|
minitest (>= 5.1)
|
@@ -80,9 +79,9 @@ GEM
|
|
80
79
|
rails-html-sanitizer (1.6.0)
|
81
80
|
loofah (~> 2.21)
|
82
81
|
nokogiri (~> 1.14)
|
83
|
-
railties (7.0.7)
|
84
|
-
actionpack (= 7.0.7)
|
85
|
-
activesupport (= 7.0.7)
|
82
|
+
railties (7.0.7.2)
|
83
|
+
actionpack (= 7.0.7.2)
|
84
|
+
activesupport (= 7.0.7.2)
|
86
85
|
method_source
|
87
86
|
rake (>= 12.2)
|
88
87
|
thor (~> 1.0)
|
@@ -93,9 +92,6 @@ GEM
|
|
93
92
|
rb-inotify (0.10.1)
|
94
93
|
ffi (~> 1.0)
|
95
94
|
rbs (3.1.3)
|
96
|
-
rbs_rails (0.12.0)
|
97
|
-
parser
|
98
|
-
rbs (>= 1)
|
99
95
|
regexp_parser (2.8.1)
|
100
96
|
rexml (3.2.6)
|
101
97
|
rspec (3.12.0)
|
@@ -6,8 +6,10 @@ module RbsActiveHash
|
|
6
6
|
class InstallGenerator < Rails::Generators::Base
|
7
7
|
def create_raketask
|
8
8
|
create_file "lib/tasks/rbs_active_hash.rake", <<~RUBY
|
9
|
+
# frozen_string_literal: true
|
10
|
+
|
9
11
|
begin
|
10
|
-
require
|
12
|
+
require "rbs_active_hash/rake_task"
|
11
13
|
|
12
14
|
RbsActiveHash::RakeTask.new
|
13
15
|
rescue LoadError
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rbs"
|
4
|
-
require "rbs_rails/util"
|
5
4
|
require "active_hash"
|
6
5
|
|
7
6
|
module RbsActiveHash
|
@@ -19,7 +18,7 @@ module RbsActiveHash
|
|
19
18
|
|
20
19
|
def initialize(klass)
|
21
20
|
@klass = klass
|
22
|
-
@klass_name =
|
21
|
+
@klass_name = klass.name || ""
|
23
22
|
@parser = ActiveHash::Parser::Parser.new
|
24
23
|
|
25
24
|
path, = Object.const_source_location(klass_name)
|
@@ -29,7 +28,7 @@ module RbsActiveHash
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def generate
|
32
|
-
if klass
|
31
|
+
if klass < ::ActiveFile::Base
|
33
32
|
begin
|
34
33
|
klass.reload
|
35
34
|
rescue StandardError
|
@@ -37,11 +36,18 @@ module RbsActiveHash
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
|
39
|
+
format(klass_decl)
|
41
40
|
end
|
42
41
|
|
43
42
|
private
|
44
43
|
|
44
|
+
def format(rbs)
|
45
|
+
parsed = RBS::Parser.parse_signature(rbs)
|
46
|
+
StringIO.new.tap do |out|
|
47
|
+
RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
|
48
|
+
end.string
|
49
|
+
end
|
50
|
+
|
45
51
|
def klass_decl
|
46
52
|
<<~RBS
|
47
53
|
#{header}
|
@@ -62,7 +68,7 @@ module RbsActiveHash
|
|
62
68
|
when Class
|
63
69
|
# @type var superclass: Class
|
64
70
|
superclass = _ = mod_object.superclass
|
65
|
-
superclass_name =
|
71
|
+
superclass_name = superclass.name || "Object"
|
66
72
|
|
67
73
|
"class #{mod_name} < ::#{superclass_name}"
|
68
74
|
when Module
|
data/rbs_active_hash.gemspec
CHANGED
@@ -29,7 +29,6 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency "active_hash"
|
31
31
|
spec.add_dependency "rbs"
|
32
|
-
spec.add_dependency "rbs_rails"
|
33
32
|
|
34
33
|
# For more information and examples about making a new gem, check out our
|
35
34
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/rbs_collection.lock.yaml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
sources:
|
3
3
|
- type: git
|
4
4
|
name: ruby/gem_rbs_collection
|
5
|
-
revision:
|
5
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
6
6
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
7
7
|
repo_dir: gems
|
8
8
|
path: ".gem_rbs_collection"
|
@@ -175,10 +175,6 @@ gems:
|
|
175
175
|
version: 3.1.3
|
176
176
|
source:
|
177
177
|
type: rubygems
|
178
|
-
- name: rbs_rails
|
179
|
-
version: 0.12.0
|
180
|
-
source:
|
181
|
-
type: rubygems
|
182
178
|
- name: rdoc
|
183
179
|
version: '0'
|
184
180
|
source:
|
@@ -20,7 +20,7 @@ module RbsActiveHash
|
|
20
20
|
def parse: (String string, Array[Symbol] target) -> void
|
21
21
|
def process: (RBS::AST::Declarations::t | RBS::AST::Members::t node, Array[Symbol] target) -> void
|
22
22
|
def process_association_definition: (AssociationDefinition node) -> void
|
23
|
-
def process_scope_definition: (
|
23
|
+
def process_scope_definition: (ScopeDefinition node) -> void
|
24
24
|
def node_to_literal: (untyped node) -> untyped
|
25
25
|
end
|
26
26
|
end
|
@@ -13,6 +13,7 @@ module RbsActiveHash
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
+
def format: (String) -> String
|
16
17
|
def klass_decl: () -> String
|
17
18
|
def header: () -> String
|
18
19
|
def enum_decls: () -> String?
|
@@ -25,7 +26,7 @@ module RbsActiveHash
|
|
25
26
|
def method_decls: () -> String
|
26
27
|
def method_names: () -> Array[Symbol]
|
27
28
|
def method_types: () -> Hash[Symbol, untyped]
|
28
|
-
def valid_field_name?: (String) -> boolish
|
29
|
+
def valid_field_name?: (String | Symbol) -> boolish
|
29
30
|
def footer: () -> String
|
30
31
|
|
31
32
|
def identify_class: (untyped value) -> (String | singleton(Class))
|
@@ -6,7 +6,7 @@ module RbsActiveHash
|
|
6
6
|
@name: Symbol
|
7
7
|
@signature_root_dir: Pathname
|
8
8
|
|
9
|
-
def initialize: (Symbol name) { (RakeTask) -> void } -> void
|
9
|
+
def initialize: (?Symbol name) { (RakeTask) -> void } -> void
|
10
10
|
def define_setup_task: () -> void
|
11
11
|
def define_clean_task: () -> void
|
12
12
|
def define_generate_task: () -> void
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_active_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi KOMIYA
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rbs_rails
|
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
41
|
description: A RBS files generator for ActiveHash models
|
56
42
|
email:
|
57
43
|
- i.tkomiya@gmail.com
|