Class: Yarrow::Config::OutputManifest
- Inherits:
-
Schema::Entity
- Object
- Schema::Entity
- Yarrow::Config::OutputManifest
- Defined in:
- lib/yarrow/config.rb
Overview
Document mapping configuration block
Constant Summary collapse
- DEFAULT_URL_SCHEME =
"/{ancestors*}"
Class Method Summary collapse
Methods inherited from Schema::Entity
[], attribute, dictionary, inherited, #initialize, #merge, #to_h
Constructor Details
This class inherits a constructor from Yarrow::Schema::Entity
Class Method Details
.from_spec(input, context) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/yarrow/config.rb', line 75 def self.from_spec(input, context) attrs = {} if input.is_a?(TrueClass) attrs[:layout] = context[:key].to_s elsif input.is_a?(FalseClass) raise "Reconciliation for content type #{context[:key]} cannot be skipped (yet)" elsif input.is_a?(Symbol) attrs[:layout] = input.to_s elsif input.is_a?(String) attrs[:layout] = context[:key].to_s attrs[:scheme] = input elsif input.is_a?(Hash) attrs = input else raise "Invalid data for output manifest: #{input.class}" end unless attrs.key?(:scheme) attrs[:scheme] = DEFAULT_URL_SCHEME end new(attrs) end |