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, #normalized_path, #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.



238
239
240
241
242
# File 'lib/middleman-core/sitemap/resource.rb', line 238

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)


252
253
254
# File 'lib/middleman-core/sitemap/resource.rb', line 252

def binary?
  false
end

#renderObject



248
249
250
# File 'lib/middleman-core/sitemap/resource.rb', line 248

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

#template?Boolean

Returns:

  • (Boolean)


244
245
246
# File 'lib/middleman-core/sitemap/resource.rb', line 244

def template?
  true
end