Class: Middleman::Sitemap::ProxyResource
- Defined in:
- middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb
Constant Summary
Constants inherited from Resource
Resource::FILTER, Resource::MAYBE_METADATA_CONTRACT, Resource::METADATA_CONTRACT
Constants included from Contracts
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#target_resource ⇒ Object
readonly
Returns the value of attribute target_resource.
Attributes inherited from Resource
#app, #destination_path, #path, #priority, #vertices
Instance Method Summary collapse
- #content_type ⇒ Object
- #file_descriptor ⇒ Object
-
#initialize(store, path, target) ⇒ ProxyResource
constructor
Initialize resource with parent store and URL.
- #locals ⇒ Object
- #options ⇒ Object
- #page ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Methods inherited from Resource
#<=>, #Any, #Bool, #Hash, #String, #add_filter, #add_metadata, #add_metadata_locals, #add_metadata_options, #add_metadata_page, #binary?, #data, #ext, #ignore!, #ignored?, #metadata, #normalized_path, #page_id, #proxy_to, #render, #render_without_filters, #source_file, #static_file?, #template?, #url
Methods included from Extensions::Traversal
#children, #directory_index?, #eponymous_directory?, #eponymous_directory_path, #parent, #parent_helper, #siblings, #traversal_root
Methods included from Contracts
Constructor Details
#initialize(store, path, target) ⇒ ProxyResource
Initialize resource with parent store and URL
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 80 def initialize(store, path, target) super(store, path, nil, 2) target = ::Middleman::Util.normalize_path(target) raise "You can't proxy #{path} to itself!" if target == path @target = target @target_resource = @store.by_path(@target) raise "Path #{path} proxies to unknown file #{@target}" unless @target_resource raise "You can't proxy #{path} to #{@target} which is itself a proxy." if @target_resource.is_a? ProxyResource end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
71 72 73 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 71 def target @target end |
#target_resource ⇒ Object (readonly)
Returns the value of attribute target_resource.
74 75 76 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 74 def target_resource @target_resource end |
Instance Method Details
#content_type ⇒ Object
111 112 113 114 115 116 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 111 def content_type mime_type = super return mime_type if mime_type target_resource.content_type end |
#file_descriptor ⇒ Object
94 95 96 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 94 def file_descriptor target_resource.file_descriptor end |
#locals ⇒ Object
106 107 108 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 106 def locals target_resource.locals.deep_merge super end |
#options ⇒ Object
102 103 104 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 102 def target_resource..deep_merge super end |
#page ⇒ Object
98 99 100 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 98 def page target_resource.page.deep_merge super end |
#to_s ⇒ Object Also known as: inspect
118 119 120 |
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 118 def to_s "#<#{self.class} path=#{@path} target=#{@target}>" end |