Class: Amiba::Source::PageEntry

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

Instance Method Summary collapse

Methods included from Amiba::Source

included

Constructor Details

#initialize(page) ⇒ PageEntry

Returns a new instance of PageEntry.



52
53
54
55
56
# File 'lib/amiba/source/entry.rb', line 52

def initialize(page)
  self.name = page.name
  self.format = "markdown"
  @content =  File.read(filename) unless self.new? 
end

Instance Method Details

#filenameObject Also known as: output_filename



64
65
66
# File 'lib/amiba/source/entry.rb', line 64

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

#renderObject



68
69
70
# File 'lib/amiba/source/entry.rb', line 68

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

#save {|filename, content| ... } ⇒ Object

Yields:



58
59
60
61
62
# File 'lib/amiba/source/entry.rb', line 58

def save(&block)
  return false unless valid?
  yield filename, content
  true
end