From 6b2c44794b8aeeca96a9b3114b87b3c1df69fd9d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 1 Oct 2012 15:43:19 -0400 Subject: v3: cosmetic code, .is_a?(X) replaces .class==X (& some defined? & nil? tests) --- lib/sisu/v3/harvest_authors.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/sisu/v3/harvest_authors.rb') 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 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

#{@letter}

} end @output[lng][:html] << %{\n

#{@letter}

} @@ -340,7 +340,7 @@ WOK do_string_name(lng,'',a) name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') x = %{

#{a[0]}

} - 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]}", %{

#{x[:date]} #{x[:title]}, #{x[:author][:authors_s]}

} ] - works<<=(@output[lng][:html_mnt].class==File) \ + works<<=(@output[lng][:html_mnt].is_a?(File)) \ ? (work.concat([%{

[src]  #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]} -- [#{x[:file]}.sst]

}])) : 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 -- cgit v1.2.3