class SiSU_XHTML_EPUB2_Concordance::Source

Public Class Methods

new(opt) click to toggle source
# File lib/sisu/xhtml_epub2_concordance.rb, line 64
def initialize(opt)
  @opt=opt
  @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end

Public Instance Methods

read() click to toggle source
# File lib/sisu/xhtml_epub2_concordance.rb, line 68
def read
  begin
    @env,@md=@particulars.env,@particulars.md
    wordmax=@env.concord_max
    unless @md.wc_words.nil?
      if @md.wc_words < wordmax
        SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet
      else
        SiSU_Screen::Ansi.new(
          @md.opt.act[:color_state][:set],
          "*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})"
        ).warn unless @md.opt.act[:quiet][:set]==:on
      end
    else
      SiSU_Screen::Ansi.new(
        @md.opt.act[:color_state][:set],
        "*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words"
      ).warn unless @md.opt.act[:quiet][:set]==:on
      SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet
    end
  rescue
    SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
  end
end