Module: Waves::Views::Mixin
Defined Under Namespace
Modules: Ext
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ResponseMixin
#app, #app_name, #attributes, #basename, #captured, #extension, #log, #model, #model_name, #params, #paths, #query, #redirect, #resource, #response, #traits
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
13 14 15 |
# File 'lib/views/mixin.rb', line 13 def request @request end |
Class Method Details
.included(target) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/views/mixin.rb', line 17 def self.included( target ) target.send(:include, Ext) unless target.instance_methods.include?("render") #Don't redefine render def target.process( request, *args, &block ) self.new( request ).instance_exec( *args, &block ) end end |
Instance Method Details
#initialize(request) ⇒ Object
24 25 26 27 28 |
# File 'lib/views/mixin.rb', line 24 def initialize( request ) @request = request @layout = :default clear! if respond_to?(:clear!) #For Hoshi compatibility end |
#template_file(name) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/views/mixin.rb', line 30 def template_file(name) template = "templates/#{self.class.basename.snake_case}/#{name}" extensions = Views.extensions.join(',') # globbing on a {x,y,z} group returns the found files in x,y,z order raise NoTemplateError.new( path ) unless file = Dir["#{template}.{#{extensions}}"].first file end |