Class: Yarrow::Content::ContentType
- Inherits:
-
Object
- Object
- Yarrow::Content::ContentType
- Defined in:
- lib/yarrow/content/content_type.rb
Constant Summary collapse
- Value =
Yarrow::Schema::Value.new(:collection, :entity, :extensions)
- DEFAULT_EXTENSIONS =
[".md", ".yml", ".htm"]
Class Method Summary collapse
Instance Method Summary collapse
- #collection ⇒ Object
- #entity ⇒ Object
- #extensions ⇒ Object
-
#initialize(properties) ⇒ ContentType
constructor
A new instance of ContentType.
- #match_path ⇒ Object
Constructor Details
#initialize(properties) ⇒ ContentType
Returns a new instance of ContentType.
14 15 16 17 18 19 20 |
# File 'lib/yarrow/content/content_type.rb', line 14 def initialize(properties) unless properties.respond_to?(:collection) || properties.respond_to?(:entity) raise "Must provide a collection name or entity name" end @properties = properties end |
Class Method Details
Instance Method Details
#collection ⇒ Object
22 23 24 25 |
# File 'lib/yarrow/content/content_type.rb', line 22 def collection return @properties.collection if @properties.collection Yarrow::Symbols.to_plural(@properties.entity) end |
#entity ⇒ Object
27 28 29 30 |
# File 'lib/yarrow/content/content_type.rb', line 27 def entity return @properties.entity if @properties.entity Yarrow::Symbols.to_singular(@properties.collection) end |
#extensions ⇒ Object
32 33 34 35 |
# File 'lib/yarrow/content/content_type.rb', line 32 def extensions return @properties.extensions if @properties.extensions DEFAULT_EXTENSIONS end |
#match_path ⇒ Object
37 38 39 |
# File 'lib/yarrow/content/content_type.rb', line 37 def match_path "." end |