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/dal_numbering.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/sisu/v3/dal_numbering.rb') diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb index 4c7ad642..f81563f3 100644 --- a/lib/sisu/v3/dal_numbering.rb +++ b/lib/sisu/v3/dal_numbering.rb @@ -82,7 +82,7 @@ module SiSU_DAL_Numbering && dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks end - unless dob.obj.class==Array + unless dob.obj.is_a?(Array) dob.obj=dob.obj.gsub(/^\s+/,''). gsub(/\s$/,"\n") end @@ -160,7 +160,7 @@ module SiSU_DAL_Numbering if dob.ln==no1 t_no1+=1; t_no2=0; t_no3=0 title_no="#{t_no1}" - if not @md.seg_names.nil? \ + if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(title_no) if dob.ln==no1 dob.name="#{title_no}" if not dob.name @@ -303,7 +303,7 @@ module SiSU_DAL_Numbering possible_seg_name=$1 possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') - if not @md.seg_names.nil? \ + if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(possible_seg_name) dob.name=possible_seg_name dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ @@ -313,7 +313,7 @@ module SiSU_DAL_Numbering end if dob.ln==4 \ and dob.name #extract segment name from embedded document structure info - if not @md.seg_names.nil? \ + if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(dob.name) dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ @md.seg_names << dob.name @@ -323,7 +323,7 @@ module SiSU_DAL_Numbering and not dob.name #if still no segment name, provide a numerical one pf='_' #pg='' #may use e.g. '' or '~' or '_' segn_auto="#{pf}#{art_filename_auto.to_s}" - if not @md.seg_names.nil? \ + if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(segn_auto) dob.name=segn_auto dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs -- cgit v1.2.3