Class: Middleman::Tapirgo::SyncableItem
- Inherits:
-
Object
- Object
- Middleman::Tapirgo::SyncableItem
- Defined in:
- lib/middleman-tapirgo/syncable_item.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(resource) ⇒ SyncableItem
constructor
A new instance of SyncableItem.
- #link ⇒ Object
- #published_on ⇒ Object
- #title ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(resource) ⇒ SyncableItem
Returns a new instance of SyncableItem.
6 7 8 |
# File 'lib/middleman-tapirgo/syncable_item.rb', line 6 def initialize(resource) @resource = resource end |
Instance Method Details
#content ⇒ Object
10 11 12 |
# File 'lib/middleman-tapirgo/syncable_item.rb', line 10 def content @resource.render(:layout => nil) end |
#link ⇒ Object
24 25 26 |
# File 'lib/middleman-tapirgo/syncable_item.rb', line 24 def link @resource.path end |
#published_on ⇒ Object
14 15 16 17 18 |
# File 'lib/middleman-tapirgo/syncable_item.rb', line 14 def published_on Time.parse(@resource.data['date']) rescue File.mtime(@resource.source_file) end |
#title ⇒ Object
20 21 22 |
# File 'lib/middleman-tapirgo/syncable_item.rb', line 20 def title @resource.data['title'] || @resource.path end |
#to_hash ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/middleman-tapirgo/syncable_item.rb', line 28 def to_hash { :title => title, :content => content, :link => link, :published_on => published_on } end |