lib/eco/api/common/people/person_parser.rb in eco-helpers-1.0.3 vs lib/eco/api/common/people/person_parser.rb in eco-helpers-1.0.4
- old
+ new
@@ -55,11 +55,11 @@
# Scopes `source_attrs` using the schema _**details** attributes_.
# @note use this helper to know which among your attributes are schema **details** ones.
# @param source_attrs [Array<String>]
# @return [Array<String>] the scoped **details** attributes, if `source_attrs` is not `nil`. All the _details attributes_, otherwise.
def target_attrs_details(source_attrs = nil)
- return @details_attrs if ! source_attrs
+ return @details_attrs if !source_attrs
scoped_attrs(source_attrs, @details_attrs)
end
# Scopes `source_attrs` using the schema _**account** attributes_.
# @note use this helper to know which among your attributes are **account** ones.
@@ -75,13 +75,16 @@
#def list_defined
# @parsers.keys
#end
# Returns a list of all the internal attributes of the model that have a parser defined.
- # @note it excludes any parser that is not in the model, such as type parsers (i.e. `:boolean`, `:multiple`)
+ # @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)
end
# Returns a list of all the internal attributes of the model that have a parser defined & that should be active.
# @param [Hash, Array<String>]