Class: Middleman::DataSource::Extension
- Inherits:
-
Extension
- Object
- Extension
- Middleman::DataSource::Extension
- Defined in:
- lib/middleman/data_source/extension.rb
Defined Under Namespace
Classes: UnsupportedDataExtension
Instance Attribute Summary collapse
-
#app_inst ⇒ Object
readonly
Returns the value of attribute app_inst.
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#decoders ⇒ Object
readonly
Returns the value of attribute decoders.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
-
#initialize(app, options_hash = {}, &block) ⇒ Extension
constructor
A new instance of Extension.
- #rack_app ⇒ Object
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ Extension
Returns a new instance of Extension.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/middleman/data_source/extension.rb', line 21 def initialize app, ={}, &block super app, , &block @app_inst = app.respond_to?(:inst) ? app.inst : app @sources = .sources.dup + convert_files_to_sources(.files) @decoders = default_decoders.merge(.decoders) if .collection.empty? @collection = false else @collection = .collection sources.push .collection.merge alias: File.join( .collection[:alias], 'all' ) end sources.each do |source| add_data_callback_for_source(source) end if collection collection[:items].call( app_inst.data[collection[:alias]]['all'] ).map do |source| source[:alias] = File.join(collection[:alias], source[:alias]) source end.each do |source| add_data_callback_for_source(source) end end end |
Instance Attribute Details
#app_inst ⇒ Object (readonly)
Returns the value of attribute app_inst.
14 15 16 |
# File 'lib/middleman/data_source/extension.rb', line 14 def app_inst @app_inst end |
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
14 15 16 |
# File 'lib/middleman/data_source/extension.rb', line 14 def collection @collection end |
#decoders ⇒ Object (readonly)
Returns the value of attribute decoders.
14 15 16 |
# File 'lib/middleman/data_source/extension.rb', line 14 def decoders @decoders end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
14 15 16 |
# File 'lib/middleman/data_source/extension.rb', line 14 def sources @sources end |
Instance Method Details
#rack_app ⇒ Object
17 18 19 |
# File 'lib/middleman/data_source/extension.rb', line 17 def rack_app @_rack_app ||= ::Rack::Test::Session.new( ::Rack::MockSession.new( .rack_app ) ) end |