diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-10-01 15:43:19 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-10-01 15:43:19 -0400 |
commit | 6b2c44794b8aeeca96a9b3114b87b3c1df69fd9d (patch) | |
tree | 20ffa7c21eda17b340e473733088fa80986cc0d6 /lib/sisu/v3/harvest_authors.rb | |
parent | v3: cosmetic code, if true ; x, remove semicolons replace with "then" (diff) |
v3: cosmetic code, .is_a?(X) replaces .class==X (& some defined? & nil? tests)
Diffstat (limited to 'lib/sisu/v3/harvest_authors.rb')
-rw-r--r-- | lib/sisu/v3/harvest_authors.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb index 6036816d..7c044425 100644 --- a/lib/sisu/v3/harvest_authors.rb +++ b/lib/sisu/v3/harvest_authors.rb @@ -157,7 +157,7 @@ module SiSU_HarvestAuthors idx_array.each do |idx| idx[:author][:last_first_format_a].each do |author| author=author.strip - if @@the_idx_authors[lang][author].class==NilClass + if @@the_idx_authors[lang][author].is_a?(NilClass) @@the_idx_authors[lang][author]={ md: [] } end @@the_idx_authors[lang][author][:md] << { filename: idx[:filename], file: idx[:file], author: idx[:author], title: idx[:title], date: idx[:date], page: idx[:page], lang: idx[:lang] } @@ -201,7 +201,7 @@ module SiSU_HarvestAuthors def html_file_close @the_idx.keys.each do |lng| @output[lng][:html].close - @output[lng][:html_mnt].close if @output[lng][:html_mnt].class==File + @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File) end end def html_print @@ -305,12 +305,12 @@ WOK </html> WOK @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a if @output[lng][:html_mnt].class==File + @output[lng][:html_mnt] << a if @output[lng][:html_mnt].is_a?(File) @output[lng][:html] << a end end def do_html(lng,html) - @output[lng][:html_mnt] << html if @output[lng][:html_mnt].class==File + @output[lng][:html_mnt] << html if @output[lng][:html_mnt].is_a?(File) @output[lng][:html] << html end def do_string_name(lng,attrib,string) @@ -324,7 +324,7 @@ WOK while @letter < f if @alph.length > 0 @letter=@alph.shift - if @output[lng][:html_mnt].class==File + if @output[lng][:html_mnt].is_a?(File) @output[lng][:html_mnt] << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>} end @output[lng][:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>} @@ -340,7 +340,7 @@ WOK do_string_name(lng,'',a) name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') x = %{<p class="author"><a name="#{name}">#{a[0]}</a></p>} - if @output[lng][:html_mnt].class==File + if @output[lng][:html_mnt].is_a?(File) @output[lng][:html_mnt] << x end @output[lng][:html] << x @@ -356,13 +356,13 @@ WOK "../#{x[:file]}/#{x[:page]}" end work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ] - works<<=(@output[lng][:html_mnt].class==File) \ + works<<=(@output[lng][:html_mnt].is_a?(File)) \ ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>] #{x[:date]} <a href="file://#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) : work end works.sort_by {|x| x[0]}.each do |x| @output[lng][:html] << x[1] - @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].class==File + @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].is_a?(File) end end end |