Class: Alula::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/alula/generator.rb

Direct Known Subclasses

FeedBuilder, Paginate, Sitemap

Defined Under Namespace

Classes: FeedBuilder, Paginate, Sitemap

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, opts) ⇒ Generator

Returns a new instance of Generator.



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

def initialize(options, opts)
  @options = options
  @site = opts.delete(:site)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/alula/generator.rb', line 7

def options
  @options
end

#siteObject (readonly)

Returns the value of attribute site.



8
9
10
# File 'lib/alula/generator.rb', line 8

def site
  @site
end

Class Method Details

.load(opts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/alula/generator.rb', line 10

def self.load(opts)
  type = opts.delete(:type)
  options = opts.delete(:options)
  
  # Try to find our generator
  cls_name = self.constants.select {|t| t.to_s.downcase == type.downcase}.first
  if cls_name
    cls = self.const_get(cls_name)
    gen = cls.new(options, opts)
  end
end

Instance Method Details

#substitutes(locale, item) ⇒ Object



27
28
29
# File 'lib/alula/generator.rb', line 27

def substitutes(locale, item)
  {}
end