Class: Rindle

Inherits:
Object
  • Object
show all
Defined in:
lib/rindle.rb,
lib/rindle/index.rb,
lib/rindle/version.rb,
lib/rindle/document.rb,
lib/rindle/collection.rb,
lib/rindle/collections.rb,
lib/rindle/mixins/regexp.rb

Overview

This module is used to load the Kindles state into the data structures, which are used to let you access the Kindles content in a way, that reminds one of the ActiveRecord usage

Load from a specific path

Rindle.load(path)

After that you may use the models ‘Collection` and `Document`.

Defined Under Namespace

Modules: Mixins Classes: Collection, Collections, Document, Index, NotLoaded

Constant Summary collapse

VERSION =
"0.3.4"
@@root_path =
nil
@@collections =
nil
@@index =
nil

Class Method Summary collapse

Class Method Details

.collectionsObject



42
43
44
45
46
47
48
# File 'lib/rindle.rb', line 42

def collections
  if @@collections
    @@collections
  else
    raise NotLoaded
  end
end

.indexObject



34
35
36
37
38
39
40
# File 'lib/rindle.rb', line 34

def index
  if @@index
    @@index
  else
    raise NotLoaded
  end
end

.load(root_path) ⇒ Object



50
51
52
53
54
# File 'lib/rindle.rb', line 50

def load root_path
  @@root_path = root_path
  @@index = Index.load(root_path)
  @@collections = Collections.load(root_path)
end

.root_pathObject



26
27
28
29
30
31
32
# File 'lib/rindle.rb', line 26

def root_path
  if @@root_path
    @@root_path
  else
    raise NotLoaded
  end
end

.saveObject



56
57
58
# File 'lib/rindle.rb', line 56

def save
  @@collections.save
end