Method: OakTree::PostData#initialize
- Defined in:
- lib/oaktree/post_data.rb
#initialize(source_name, spec) ⇒ PostData
Loads a new post from the source file using the given Specification. The source file should be the full filename of the source file, but without any other path components.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/oaktree/post_data.rb', line 51 def initialize(source_name, spec) set_post_defaults @metadata = {} self.spec = spec self.hash = nil self.last_read_time = Time.at(0).to_datetime self.source_name = source_name self.source_path = File.absolute_path(source_name, spec.sources_root).freeze() raise "File doesn't exist: #{@source_path}" if ! File.exists? @source_path sync_changes true end |