Class: Amiba::Source::Entry

Inherits:
Object
  • Object
show all
Extended by:
EntryFinder
Includes:
Amiba::Source
Defined in:
lib/amiba/source/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EntryFinder

method_missing

Methods included from Amiba::Source

included

Constructor Details

#initialize(category, name, format, metadata = nil, content = nil) ⇒ Entry

Returns a new instance of Entry.


19
20
21
22
23
24
25
26
# File 'lib/amiba/source/entry.rb', line 19

def initialize(category, name, format,  = nil, content = nil)
  self.category = category
  self.name = name
  self.format = format
  self. = 
  self.["layout"] ||= category.to_s
  self.content = content
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category


14
15
16
# File 'lib/amiba/source/entry.rb', line 14

def category
  @category
end

Instance Method Details

#filenameObject


28
29
30
# File 'lib/amiba/source/entry.rb', line 28

def filename
  File.join("entries", category.to_s.downcase.pluralize, name + ".#{format.to_s}")
end

36
37
38
# File 'lib/amiba/source/entry.rb', line 36

def link
  URI.escape( ["", category.to_s.downcase.pluralize, "#{name}.html"].join("/") )
end

#output_filenameObject


32
33
34
# File 'lib/amiba/source/entry.rb', line 32

def output_filename
  File.join(Amiba::Configuration.site_dir, 'public', category.to_s.downcase.pluralize, "#{name}.html")
end

#refObject


44
45
46
# File 'lib/amiba/source/entry.rb', line 44

def ref
  "#{category.to_s.downcase.pluralize}_#{name}"
end

#renderObject


40
41
42
# File 'lib/amiba/source/entry.rb', line 40

def render
  Amiba::Tilt.new(self).render(Amiba::Scope.new(self))
end