@@ -137,6 +137,7 @@ def self.expose(*args, &block)
137
137
138
138
@nested_attributes ||= [ ]
139
139
140
+ # rubocop:disable Style/Next
140
141
args . each do |attribute |
141
142
unless @nested_attributes . empty?
142
143
orig_attribute = attribute . to_sym
@@ -466,22 +467,22 @@ def serializable_hash(runtime_options = {})
466
467
opts = options . merge ( runtime_options || { } )
467
468
468
469
valid_exposures . each_with_object ( { } ) do |( attribute , exposure_options ) , output |
469
- if should_return_attribute? ( attribute , opts ) && conditions_met? ( exposure_options , opts )
470
- partial_output = value_for ( attribute , opts )
471
-
472
- output [ self . class . key_for ( attribute ) ] =
473
- if partial_output . respond_to? ( :serializable_hash )
474
- partial_output . serializable_hash ( runtime_options )
475
- elsif partial_output . is_a? ( Array ) && !partial_output . map { |o | o . respond_to? ( :serializable_hash ) } . include? ( false )
476
- partial_output . map ( &:serializable_hash )
477
- elsif partial_output . is_a? ( Hash )
478
- partial_output . each do |key , value |
479
- partial_output [ key ] = value . serializable_hash if value . respond_to? ( :serializable_hash )
480
- end
481
- else
482
- partial_output
470
+ next unless should_return_attribute? ( attribute , opts ) && conditions_met? ( exposure_options , opts )
471
+
472
+ partial_output = value_for ( attribute , opts )
473
+
474
+ output [ self . class . key_for ( attribute ) ] =
475
+ if partial_output . respond_to? ( :serializable_hash )
476
+ partial_output . serializable_hash ( runtime_options )
477
+ elsif partial_output . is_a? ( Array ) && !partial_output . map { |o | o . respond_to? ( :serializable_hash ) } . include? ( false )
478
+ partial_output . map ( &:serializable_hash )
479
+ elsif partial_output . is_a? ( Hash )
480
+ partial_output . each do |key , value |
481
+ partial_output [ key ] = value . serializable_hash if value . respond_to? ( :serializable_hash )
483
482
end
484
- end
483
+ else
484
+ partial_output
485
+ end
485
486
end
486
487
end
487
488
0 commit comments