camel_snake_struct 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/camel_snake_struct.gemspec +1 -1
- data/lib/camel_snake_struct.rb +10 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97260b87ce81c6f4978d10d4270bd174bfd11bb6ef6bbce8c9138cb9cf383296
|
4
|
+
data.tar.gz: 0b6ca2254ef5e5d5c7eb0820570110799ffc473a3ae0a55029ba59c27f2050d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '044484cd1956e71dcc40306c860631729075df2eb1eb4b7726b0b382fc0e0473ff2028ac940174ed60b5fbc5003096775605aa25428a17d0631255eddc23f4fc'
|
7
|
+
data.tar.gz: 5e1d558fba3441f9cd6cfc1e273834003d3bd58d8e8c37313c238e4196156e91556d0656ad9681d0f26560fb6a064ec3f0d00e4d98902f9443f98d6d8893ae5d
|
data/README.md
CHANGED
@@ -98,6 +98,8 @@ module Tapioca
|
|
98
98
|
sig { override.void }
|
99
99
|
def decorate
|
100
100
|
root.create_path(constant) do |klass|
|
101
|
+
klass.create_method('to_h', parameters: [], return_type: "T::Hash[String, T.untyped]")
|
102
|
+
|
101
103
|
constant.types_meta_data.each do |name, meta_data|
|
102
104
|
classes = meta_data.classes.to_a.map{|a| [TrueClass,FalseClass].include?(a) ? "T::Boolean" : a.to_s }.uniq
|
103
105
|
return_type = if classes.size == 1
|
data/camel_snake_struct.gemspec
CHANGED
data/lib/camel_snake_struct.rb
CHANGED
@@ -29,15 +29,22 @@ class CamelSnakeStruct
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.store_meta_data(example_class, m_name, result)
|
32
|
-
types_meta_data = (example_class.types_meta_data[m_name] ||= Type__Meta__Data.new(Set.new, false))
|
33
32
|
if result.is_a?(Array)
|
34
|
-
|
35
|
-
result.map(&:class).each { |c| types_meta_data.class_types << c }
|
33
|
+
add_array_meta_data(example_class, m_name, result)
|
36
34
|
else
|
35
|
+
types_meta_data = (example_class.types_meta_data[m_name] ||= Type__Meta__Data.new(Set.new, false))
|
37
36
|
types_meta_data.class_types << result.class
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
40
|
+
def self.add_array_meta_data(example_class, m_name, result)
|
41
|
+
return if result.length == 0
|
42
|
+
|
43
|
+
types_meta_data = (example_class.types_meta_data[m_name] ||= Type__Meta__Data.new(Set.new, false))
|
44
|
+
types_meta_data.array = true
|
45
|
+
result.map(&:class).each { |c| types_meta_data.class_types << c }
|
46
|
+
end
|
47
|
+
|
41
48
|
def self.types_meta_data
|
42
49
|
@types_meta_data ||= {}
|
43
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camel_snake_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Petersen-Speelman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -58,7 +58,7 @@ metadata:
|
|
58
58
|
source_code_uri: https://github.com/NEXL-LTS/camel_snake_struct-ruby
|
59
59
|
changelog_uri: https://github.com/NEXL-LTS/camel_snake_struct/CHANGELOG.md
|
60
60
|
rubygems_mfa_required: 'true'
|
61
|
-
post_install_message:
|
61
|
+
post_install_message:
|
62
62
|
rdoc_options: []
|
63
63
|
require_paths:
|
64
64
|
- lib
|
@@ -73,8 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
77
|
-
signing_key:
|
76
|
+
rubygems_version: 3.4.19
|
77
|
+
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Easily access camelCased hashes in a ruby friendly way
|
80
80
|
test_files: []
|