Module: Wgit::Model

Defined in:
lib/wgit/database/model.rb

Overview

Module containing the DB data model structure.

Author:

  • Michael Telford

Class Method Summary collapse

Class Method Details

.common_insert_dataObject



18
19
20
21
22
23
# File 'lib/wgit/database/model.rb', line 18

def self.common_insert_data
    {
        :date_added     => Wgit::Utils.time_stamp,
        :date_modified  => Wgit::Utils.time_stamp,
    }
end

.common_update_dataObject



25
26
27
28
29
# File 'lib/wgit/database/model.rb', line 25

def self.common_update_data
    {
        :date_modified  => Wgit::Utils.time_stamp,
    }
end

.document(doc) ⇒ Object



13
14
15
16
# File 'lib/wgit/database/model.rb', line 13

def self.document(doc)
    raise "doc must respond to to_h" unless doc.respond_to?(:to_h)
    doc.to_h(false)
end

.url(url) ⇒ Object



8
9
10
11
# File 'lib/wgit/database/model.rb', line 8

def self.url(url)
    raise "url must respond to to_h" unless url.respond_to?(:to_h)
    url.to_h
end