lib/eco/api/common/people/person_parser.rb in eco-helpers-2.0.3 vs lib/eco/api/common/people/person_parser.rb in eco-helpers-2.0.4

- old
+ new

@@ -97,12 +97,19 @@ # @note # - it excludes any parser that is not in the model, such as type parsers (i.e. `:boolean`, `:multiple`) # - the list is sorted according `CORE_ATTRS` + `ACCOUNT_ATTRS` + schema attrs # @return [Array<String>] list of all attribute defined parsers. def defined_attrs - defined = @parsers.keys - defined = (all_attrs || defined) && defined - defined - (defined - all_attrs) + defined = @parsers.keys + defined = (all_attrs | defined) & defined + defined - symbol_keys + end + + # Symbol keys are type or import parsers (that do not belong to the model) + # @note this was introduced to boost virtual fields to treat in different phases of the parsing process + # @return [Array<Symbol>] all the parsers defined as Symbol + def symbol_keys + @parsers.keys.filter {|k| k.is_a?(Symbol)} end # Returns a list of all the internal attributes of the model that have a parser defined & that should be active. # @param source_data [Hash, Array<String>] the data that we scope for parsing # @param phase [Symbol] the phase when the attr parser is expected to be called.