Class: Amiba::Source::Entry
- Inherits:
-
Object
- Object
- Amiba::Source::Entry
- Extended by:
- EntryFinder
- Includes:
- Amiba::Source
- Defined in:
- lib/amiba/source/entry.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(category, name, format, metadata = nil, content = nil) ⇒ Entry
constructor
A new instance of Entry.
- #link ⇒ Object
- #output_filename ⇒ Object
- #ref ⇒ Object
- #render ⇒ Object
Methods included from EntryFinder
Methods included from Amiba::Source
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
#category ⇒ Object
Returns the value of attribute category.
14 15 16 |
# File 'lib/amiba/source/entry.rb', line 14 def category @category end |
Instance Method Details
#filename ⇒ Object
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 |
#link ⇒ Object
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_filename ⇒ Object
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 |
#ref ⇒ Object
44 45 46 |
# File 'lib/amiba/source/entry.rb', line 44 def ref "#{category.to_s.downcase.pluralize}_#{name}" end |