Class Hobix::BaseStorage
In: lib/hobix/base.rb
Parent: BasePlugin

The BaseStorage class outlines the fundamental API for all storage plugins. Storage plugins are responsible for abstracting away entry queries and managing the loading of Entry objects. The goal being: cache as much as you can, be efficient and tidy.

Query Methods

find:Each of the query methods below uses the find method to perform its search. This method accepts a Hash of parameters. Please note that calling find without parameters will return all entries which qualify for placement on the front page.
all:Returns all entries. Searches find( :all => true )
lastn:Returns the last n entries which qualify for the front page.
inpath:Returns entries within a path which qualify for the front page.
after:Returns entries created after a given date.
before:Returns entries created before a given date.
within:Returns entries created between a start and end date.

Methods

after   all   before   default_entry   default_entry_id   inpath   lastn   match   new   within  

Public Class methods

[Source]

    # File lib/hobix/base.rb, line 87
87:     def initialize( weblog )
88:         @link = weblog.link
89:     end

Public Instance methods

[Source]

     # File lib/hobix/base.rb, line 113
113:     def after( after, n = nil )
114:         find( :after => after, :lastn => n )
115:     end

[Source]

     # File lib/hobix/base.rb, line 104
104:     def all
105:         find( :all => true )
106:     end

[Source]

     # File lib/hobix/base.rb, line 116
116:     def before( before, n = nil )
117:         find( :before => before, :lastn => n )
118:     end

[Source]

     # File lib/hobix/base.rb, line 91
 91:     def default_entry( author )
 92:         Hobix::Entry.new do |e|
 93:             e.id = default_entry_id 
 94:             e.link = e.class.url_link e, @link, "html"
 95:             e.created = Time.now
 96:             e.modified = Time.now
 97:             e.updated = Time.now
 98:             e.title = "This Ghostly Message From the Slime Will Soon Vanish!"
 99:             e.tagline = "A temporary message, a tingling sensation, Hobix is up!!"
100:             e.author = author
101:             e.content = Hobix::Entry.text_processor.new( "Welcome to Hobix!  Once you make your first blog post, this entry will disappear.  However, in the meantime, you can tweak the CSS of your blog until it suits your satisfaction and you have this bit of words to act as a place holder." )
102:         end
103:     end

[Source]

    # File lib/hobix/base.rb, line 90
90:     def default_entry_id; "hobix-default-entry"; end

[Source]

     # File lib/hobix/base.rb, line 110
110:     def inpath( path, n = nil )
111:         find( :inpath => path, :lastn => n )
112:     end

[Source]

     # File lib/hobix/base.rb, line 107
107:     def lastn( n )
108:         find( :lastn => ( n || 10 ) )
109:     end

[Source]

     # File lib/hobix/base.rb, line 119
119:     def match( expr )
120:         find( :match => expr )
121:     end

[Source]

     # File lib/hobix/base.rb, line 122
122:     def within( after, before )
123:         find( :after => after, :before => before )
124:     end

[Validate]