Class: Middleman::Sitemap::StringResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/middleman-core/sitemap/resource.rb

Constant Summary

Constants inherited from Resource

Resource::METADATA_HASH

Constants included from Contracts

Contracts::PATH_MATCHER

Instance Attribute Summary

Attributes inherited from Resource

#destination_path, #file_descriptor, #ignored, #metadata, #path

Instance Method Summary collapse

Methods inherited from Resource

#Any, #Bool, #Hash, #METADATA_HASH, #String, #add_metadata, #content_type, #data, #ext, #ignore!, #ignored?, #indifferent_access?, #locals, #options, #page_id, #proxy_to, #source_file, #to_s, #url

Methods included from Extensions::Traversal

#children, #directory_index?, #eponymous_directory?, #eponymous_directory_path, #parent, #siblings, #traversal_root

Methods included from Contracts

#Contract

Constructor Details

#initialize(store, path, contents = nil, &block) ⇒ StringResource

Returns a new instance of StringResource.



207
208
209
210
211
# File 'lib/middleman-core/sitemap/resource.rb', line 207

def initialize(store, path, contents=nil, &block)
  @request_path = path
  @contents = block_given? ? block : contents
  super(store, path)
end

Instance Method Details

#binary?Boolean

Returns:

  • (Boolean)


221
222
223
# File 'lib/middleman-core/sitemap/resource.rb', line 221

def binary?
  false
end

#renderObject



217
218
219
# File 'lib/middleman-core/sitemap/resource.rb', line 217

def render(*)
  @contents.respond_to?(:call) ? @contents.call : @contents
end

#template?Boolean

Returns:

  • (Boolean)


213
214
215
# File 'lib/middleman-core/sitemap/resource.rb', line 213

def template?
  true
end