Sha256: 020d30d5cfd61b7a36d4f8a6bb4dcffc371efb28d9eb94c086dd1dfc2fef014f
Contents?: true
Size: 649 Bytes
Versions: 21
Compression:
Stored size: 649 Bytes
Contents
module Writefully class Content attr_reader :index, :path attr_accessor :body def initialize(index) @index = index @path = File.join(Writefully.options[:content], index[:site], index[:resource], index[:slug]) end def body Dir.chdir(path) { File.open(Dir['README.*'].first).read } end def meta YAML.load(File.read(File.join(path, "meta.yml"))).merge({ "position" => position }) end def details Hashie::Mash.new(meta["details"]) end def slug index[:slug].split(/\A\d*-/).last end def position index[:slug].match(/\A\d*/).to_s.to_i end end end
Version data entries
21 entries across 21 versions & 1 rubygems