lib/traject/lbcc_format_classifier.rb
# A very opinionated method that just kind of jams together
# all the possible format/genre/types into one array of 1 to N elements.
#
# If no other values are present, the default value "Other" will be used.
#
# See also individual methods which you can use you seperate into
# different facets or do other custom things.
A very opinionated method that just kind of jams together
all the possible format/genre/types into one array of 1 to N elements.

If no other values are present, the default value "Other" will be used.

See also individual methods which you can use you seperate into
different facets or do other custom things.
A very opinionated method that just kind of jams together all the possible format / genre / types into one array of 1 to N elements . If no other values are present the default value " Other " will be used . See also individual methods which you can use you seperate into different facets or do other custom things .
def formats(options = {})
        options = {:default => "Unknown"}.merge(options)
        formats = []
        formats.concat genre
	begin
            f8_23 = record['008'].value[23]
	rescue NoMethodError
	    return []
	end
        if 'o' == f8_23
            if formats.include? 'Book'
                formats.delete('Book')
                formats << 'Ebook'
            elsif formats.include? 'Serial'
                formats.delete('Serial')
                formats << 'Electronic journal'
            elsif formats.include? 'Video'
                formats.delete('Video')
                formats << 'Streaming video'
            end
        end
        if formats.empty?
          formats << options[:default]
        end
        return Array(formats[0])
      end
def formats ( options = { } ) options = { :default => "Unknown" } . merge ( options ) formats = [ ] formats . concat genre begin f8_23 = record [ '008' ] . value [ 23 ] rescue NoMethodError return [ ] end if 'o' == f8_23 if formats . include? 'Book' formats . delete ( 'Book' ) formats << 'Ebook' elsif formats . include? 'Serial' formats . delete ( 'Serial' ) formats << 'Electronic journal' elsif formats . include? 'Video' formats . delete ( 'Video' ) formats << 'Streaming video' end end if formats . empty? formats << options [ :default ] end return Array ( formats [ 0 ] ) end
A very opinionated method that just kind of jams together
all the possible format/genre/types into one array of 1 to N elements.
A very opinionated method that just kind of jams together all the possible format / genre / types into one array of 1 to N elements .
options