@@ -101,9 +101,9 @@ def page
101
101
}
102
102
end
103
103
104
- def deep_transform_props ( props , parent_path = '' , &block )
104
+ def deep_transform_props ( props , parent_path = [ ] , &block )
105
105
props . reduce ( { } ) do |transformed_props , ( key , prop ) |
106
- current_path = [ parent_path , key ] . reject ( & :empty? ) . join ( '.' )
106
+ current_path = parent_path + [ key ]
107
107
108
108
if prop . is_a? ( Hash )
109
109
nested = deep_transform_props ( prop , current_path , &block )
@@ -118,11 +118,11 @@ def deep_transform_props(props, parent_path = '', &block)
118
118
end
119
119
120
120
def partial_keys
121
- ( @request . headers [ 'X-Inertia-Partial-Data' ] || '' ) . split ( ',' ) . compact . map ( & :to_sym )
121
+ ( @request . headers [ 'X-Inertia-Partial-Data' ] || '' ) . split ( ',' ) . compact
122
122
end
123
123
124
124
def partial_except_keys
125
- ( @request . headers [ 'X-Inertia-Partial-Except' ] || '' ) . split ( ',' ) . filter_map ( & :to_sym )
125
+ ( @request . headers [ 'X-Inertia-Partial-Except' ] || '' ) . split ( ',' ) . compact
126
126
end
127
127
128
128
def rendering_partial_component?
@@ -150,19 +150,18 @@ def keep_prop?(prop, path)
150
150
true
151
151
end
152
152
153
- def path_prefixes ( path )
154
- parts = path . split ( '.' )
153
+ def path_prefixes ( parts )
155
154
( 0 ...parts . length ) . map do |i |
156
155
parts [ 0 ..i ] . join ( '.' )
157
156
end
158
157
end
159
158
160
159
def excluded_by_only_partial_keys? ( path_with_prefixes )
161
- partial_keys . present? && ( path_with_prefixes & partial_keys . map ( & :to_s ) ) . empty?
160
+ partial_keys . present? && ( path_with_prefixes & partial_keys ) . empty?
162
161
end
163
162
164
163
def excluded_by_except_partial_keys? ( path_with_prefixes )
165
- partial_except_keys . present? && ( path_with_prefixes & partial_except_keys . map ( & :to_s ) ) . any?
164
+ partial_except_keys . present? && ( path_with_prefixes & partial_except_keys ) . any?
166
165
end
167
166
end
168
167
end
0 commit comments