X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=classification.rb;fp=classification.rb;h=2061e46def695b6cadbd741eb305e3480f4629e9;hp=0000000000000000000000000000000000000000;hb=b8fe580f73b094e366643388ecd2d184b643616a;hpb=2c6d69af97c152524366d3fefe1808dfb78f8f56 diff --git a/classification.rb b/classification.rb new file mode 100644 index 0000000..2061e46 --- /dev/null +++ b/classification.rb @@ -0,0 +1,75 @@ + +class Classification + def initialize(ddc, lcc, author_grouping, author, title_grouping, title) + @id = nil + @ddc = ddc + @lcc = lcc + @author_grouping = author_grouping + @author = author + @title_grouping = title_grouping + @title = title + end + + def id + @id + end + def id=(value) + @id = value + end + + def ddc + @ddc + end + def lcc + @lcc + end + def author_grouping + @author_grouping + end + def author + @author + end + def + + def inspect + data = [] + + if nil != @ddc + data.push('Dewey=' + @ddc.to_s) + end + if nil != @lcc + data.push('LCC=' + @lcc.to_s) + end + if nil != @author_grouping + data.push('author_grouping=' + @author_grouping.to_s) + end + if nil != @author + data.push('author=' + @author.to_s) + end + if nil != @title_grouping + data.push('title_grouping=' + @title_grouping.to_s) + end + if nil != @title + data.push('title=' + @title) + end + + return '(Classification:' + data.join(',') + ')' + end + + def to_s + inspect + end + + protected + def reading_to_sort_order(reading_order) + sort_order = reading_order + + parts = reading_order.split(' ') + if parts.length > 1 + sort_order = parts[-1] + ', ' + parts[0..-2].join(' ') + end + + return sort_order + end +end +