Sha256: 7ff325eeeaf476ba94baccb47ee5383f036a151bd085ba57308bb1d6f1b908d5

Contents?: true

Size: 952 Bytes

Versions: 30

Compression:

Stored size: 952 Bytes

Contents

require 'alula/storages/filestorage'

module Alula
  class Storage
    attr_reader :options
    attr_reader :outputted
    
    def self.load(opts = {})
      site = opts[:site]
      
      # Get storage class
      # puts "--> #{site.config.storage}"
      type = site.config.storage.keys.last
      cls_name = type[0].upcase + type[1..-1] + "Storage"
      if self.const_defined?(cls_name)
        cls = self.const_get(cls_name)
        return cls.new(site.config.storage[type], opts)
      else
        return nil
      end
    end
    
    def initialize(options, opts = {})
      @options = options
      @site = opts[:site]
      
      @outputted = []
    end
    
    def post(name)
      self.posts[name]
    end
    
    def page(name)
      self.pages[name]
    end
    
    def custom(name)
      if name.kind_of?(Regexp)
        self.customs.select{|key, item| key[name]}
      else
        self.customs[name]
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
alula-0.4.27 lib/alula/storage.rb
alula-0.4.26 lib/alula/storage.rb
alula-0.4.25 lib/alula/storage.rb
alula-0.4.24 lib/alula/storage.rb
alula-0.4.23 lib/alula/storage.rb
alula-0.4.22 lib/alula/storage.rb
alula-0.4.21 lib/alula/storage.rb
alula-0.4.20 lib/alula/storage.rb
alula-0.4.19 lib/alula/storage.rb
alula-0.4.18 lib/alula/storage.rb
alula-0.4.17 lib/alula/storage.rb
alula-0.4.16 lib/alula/storage.rb
alula-0.4.15 lib/alula/storage.rb
alula-0.4.14 lib/alula/storage.rb
alula-0.4.13 lib/alula/storage.rb
alula-0.4.12 lib/alula/storage.rb
alula-0.4.11 lib/alula/storage.rb
alula-0.4.11a lib/alula/storage.rb
alula-0.4.10 lib/alula/storage.rb
alula-0.4.9 lib/alula/storage.rb