lib/metacrunch/marcxml/record/datafield.rb
#
# Returns the sub fields matching the given code.
#
# @param [String, nil, Array<String>] code of the sub field
# @return [Array<Metacrunch::Marcxml::Record::Subfield>] list of sub fields with
#   the given code. The list is empty if the sub field doesn't exists.
#
Returns the sub fields matching the given code.
Returns the sub fields matching the given code .
def subfields(code = nil)
          matched_subfields = if code.nil?
            @subfields_map.values.flatten(1)
          else
            if (codes = code).is_a?(Array)
              codes.map{ |c| @subfields_map[c] }.compact.flatten(1)
            else
              @subfields_map[code]
            end
          end
          matched_subfields || []
        end
def subfields ( code = nil ) matched_subfields = if code . nil? @subfields_map . values . flatten ( 1 ) else if ( codes = code ) . is_a? ( Array ) codes . map { | c | @subfields_map [ c ] } . compact . flatten ( 1 ) else @subfields_map [ code ] end end matched_subfields || [ ] end
Returns the sub fields matching the given code.
Returns the sub fields matching the given code .
list of sub fields with the given code. The list is empty if the sub field doesn't exists.
list of sub fields with the given code . The list is empty if the sub field doesn ' t exists .
Array<Metacrunch::Marcxml::Record::Subfield>
code
<not_specific>
<not_specific>
code of the sub field
code of the sub field