Class: SiSU_HarvestAuthors::Index

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

Instance Method Summary collapse

Constructor Details

#initialize(idx_array, the_idx) ⇒ Index

Returns a new instance of Index.



168
169
170
171
# File 'lib/sisu/html_harvest_authors.rb', line 168

def initialize(idx_array,the_idx)
  @idx_array,@the_idx=idx_array,the_idx
  @@the_idx_authors=@the_idx
end

Instance Method Details

#capital(txt) ⇒ Object



172
173
174
# File 'lib/sisu/html_harvest_authors.rb', line 172

def capital(txt)
  txt[0].chr.capitalize + txt[1,txt.length]
end

#construct_book_author_indexObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/sisu/html_harvest_authors.rb', line 175

def construct_book_author_index
  idx_array=@idx_array
  idx_array.each_pair do |lang,idx_arr|
    @@the_idx_authors[lang] ||= {}
    idx_arr.each do |idx|
      idx[:author][:last_first_format_a].each do |author|
        author=author.strip
        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]
        }
      end
    end
  end
  @the_idx=@@the_idx_authors
end