Module: Decant
- Defined in:
- lib/decant.rb,
lib/decant/file.rb,
lib/decant/errors.rb,
lib/decant/content.rb,
lib/decant/version.rb,
lib/decant/collection.rb,
lib/decant/path_utils.rb,
lib/decant/frontmatter.rb
Defined Under Namespace
Modules: Frontmatter, PathUtils Classes: Collection, Content, File
Constant Summary collapse
- Error =
Class.new(StandardError)
- FileNotFound =
Class.new(Error)
- VERSION =
'0.3.0'
Class Method Summary collapse
-
.define(dir:, ext: nil) { ... } ⇒ Class<Content>
Defines a new Content subclass and assigns it a new Collection with
dir/ext.
Class Method Details
.define(dir:, ext: nil) { ... } ⇒ Class<Content>
Defines a new Content subclass and assigns it a new Collection with dir/ext. Passing a block lets you to declare convenience frontmatter readers and add your own methods.
40 41 42 43 44 45 |
# File 'lib/decant.rb', line 40 def self.define(dir:, ext: nil, &block) Class.new(Content) do @collection = Collection.new(dir: dir, ext: ext) class_eval(&block) if block_given? end end |