Class: Watts::HTMLViewResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/watts.rb

Overview

See the documentation for Watts::Resource.for_html_view().

Constant Summary

Constants inherited from Resource

Resource::HTTPMethods

Class Attribute Summary collapse

Attributes inherited from Resource

#app, #env

Instance Method Summary collapse

Methods inherited from Resource

auto_head, #default_http_method, for_html_view, #head, #initialize, #options, #request

Constructor Details

This class inherits a constructor from Watts::Resource

Class Attribute Details

.view_classObject



341
342
343
# File 'lib/watts.rb', line 341

def self.view_class
	@view_class ||= (superclass.view_class rescue nil)
end

.view_methodObject



345
346
347
# File 'lib/watts.rb', line 345

def self.view_method
	@view_method ||= (superclass.view_method rescue nil)
end

Instance Method Details

#get(*args) ⇒ Object



351
352
353
354
355
356
357
# File 'lib/watts.rb', line 351

def get *args
	body = view_class.new.send(view_method, *args)
	[200,
		{'Content-Type' => 'text/html',
		 'Content-Length' => body.bytesize.to_s},
	 [body]]
end