Class: SiSU_XHTML_EPUB2_Concordance::Source

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

Defined Under Namespace

Classes: DocTitle, Word, Words

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ Source

Returns a new instance of Source.



64
65
66
67
# File 'lib/sisu/xhtml_epub2_concordance.rb', line 64

def initialize(opt)
  @opt=opt
  @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
end

Instance Method Details

#readObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# 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