Module: Diatheke

Defined in:
lib/diatheke.rb

Defined Under Namespace

Classes: Verse

Class Method Summary collapse

Class Method Details

.modsObject



18
19
20
# File 'lib/diatheke.rb', line 18

def mods
  call('system', 'modulelistnames').split(/\n/)
end

.passage(mod, key) ⇒ Object



22
23
24
25
# File 'lib/diatheke.rb', line 22

def passage(mod, key)
  s = call(mod, key)
  parse_passage s
end

.search(mod, key, opts = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/diatheke.rb', line 27

def search(mod, key, opts={})
  search_type = :phrase
  search_key = key
  case key
  when Regexp
    search_type = :regex
    search_key = key.inspect.sub(%r(^/), '').sub(%r(/$), '')
  when Array
    search_type = :multiword
    search_key = key.join(' ')
  end
  opts[:search_type] = search_type
  s = call(mod, search_key, opts)
  parse_search s
end