Class: BomDB::Export::Verses

Inherits:
Base
  • Object
show all
Defined in:
lib/bomdb/export/verses.rb

Instance Attribute Summary

Attributes inherited from Base

#db, #opts

Instance Method Summary collapse

Methods inherited from Base

#export, #initialize

Constructor Details

This class inherits a constructor from BomDB::Export::Base

Instance Method Details

#export_jsonObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/bomdb/export/verses.rb', line 6

def export_json
  verses = []
  select_verses.each do |v|
    verses << {
      range_id: v[:verse_range_id],
      book: v[:book_name],
      chapter: v[:verse_chapter],
      verse: v[:verse_number]
    }
  end
  Export::Result.new(success: true, body: JSON.pretty_generate(verses))
end

#export_textObject



19
20
21
22
23
24
# File 'lib/bomdb/export/verses.rb', line 19

def export_text
  verses = select_verses.map do |v|
    "#{v[:book_name]} #{v[:verse_chapter]}:#{v[:verse_number]}"
  end
  Export::Result.new(success: true, body: verses.join("\n"))
end