Class: SiSU_Assemble::CompositeFileList

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/ao_composite.rb

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ CompositeFileList

Returns a new instance of CompositeFileList.



232
233
234
235
# File 'lib/sisu/ao_composite.rb', line 232

def initialize(opt)
  @opt=opt
  @env=SiSU_Env::InfoEnv.new
end

Instance Method Details

#insertions?(fns_array) ⇒ Boolean

Returns:

  • (Boolean)


248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/sisu/ao_composite.rb', line 248

def insertions?(fns_array)
  tuned_file=[]
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'Composite Document',
    @opt.fno
  ).grey_title_hi unless @opt.act[:quiet][:set]==:on
  @ssm=[@opt.fns]
  fns_array.each do |para|
    if para =~/^<<\s+(\S+?\.ss[it])$/
      loadfilename=$1.strip
      if (@opt.act[:verbose][:set]==:on \
      || @opt.act[:verbose_plus][:set]==:on \
      || @opt.act[:maintenance][:set]==:on)
        SiSU_Screen::Ansi.new(
          @opt.act[:color_state][:set],
          'loading:',
          loadfilename,
        ).txt_grey
      end
      tuned_file << if loadfilename =~ /(?:https?|file):\/\/\S+?\.ss[it]$/
        @ssm << loadfilename
      elsif loadfilename =~ /\.ss[it]$/ \
      and FileTest.file?(loadfilename)
        @ssm << loadfilename
      else
        STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfilename}"}
        $process_document = :skip; break #remove this line to continue processing documents that have missing include files
        para
      end
    end
  end
  @ssm
end

#readObject



236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/sisu/ao_composite.rb', line 236

def read
  begin
    @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub
    fns_array=IO.readlines(@opt.fns,'')
    insertions?(fns_array)
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
  end
end