X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=classify%2Fbookclass.rb;fp=classify%2Fbookclass.rb;h=20652dca9d00308f33db9129577abc2b474724ae;hp=0000000000000000000000000000000000000000;hb=2c6d69af97c152524366d3fefe1808dfb78f8f56;hpb=fcaeedd4d1c128ff84371c0a7db5d0af6751492a diff --git a/classify/bookclass.rb b/classify/bookclass.rb new file mode 100644 index 0000000..20652dc --- /dev/null +++ b/classify/bookclass.rb @@ -0,0 +1,70 @@ +# Classification information for a single book + +class BookClass + def initialize(grouping, title) + @author = nil + @ddc = nil + @grouping = grouping + @fast = [] + @lcc = nil + @title = title + end + + def author + @author + end + def author=(value) + @author = value + end + def ddc + @ddc + end + def ddc=(value) + @ddc = value + end + def fast + @fast + end + def grouping + @grouping + end + def lcc + @lcc + end + def lcc=(value) + @lcc = value + end + def title + @title + end + + def add_fast(id) + @fast.push(id) + end + + def inspect + data = [] + + if nil != @author_name + data.push('author_name="' + @author_name + '"') + end + if nil != @ddc + data.push('ddc="' + @ddc + '"') + end + if nil != @grouping + data.push('grouping="' + @grouping + '"') + end + if nil != @fast + data.push('fast=' + @fast.inspect) + end + if nil != @lcc + data.push('lcc="' + @lcc + '"') + end + if nil != @title + data.push('title="' + @title + '"') + end + + return '(BookClass:' + data.join(',') + ')' + end +end +