Sha256: aa893b0a1b5d14c43a027de7c1740badcfdfc8107066b1c6ca6dc354deeb82e6
Contents?: true
Size: 840 Bytes
Versions: 6
Compression:
Stored size: 840 Bytes
Contents
module Sharp class Action < ::Rack::Action def respond if layout view.render(layout, :main => self.class.template_name) else view.render(self.class.template_name) end end def self.base_name @base_name ||= name.sub(/Action\Z/,'') end def self.view_name @view_name ||= "#{base_name}View" end def self.view_class if defined? @view_class @view_class else @view_class = Object.const_defined?(view_name) ? view_name.constantize : Sharp::View end end def self.template_name @template_name ||= "#{base_name.underscore}.erb" end def template self.class.template_name end def layout "layouts/application.erb" end def view @view ||= self.class.view_class.new end end end
Version data entries
6 entries across 6 versions & 1 rubygems