Class: Netfira::WebConnect::RackApp::Action::Version8::Web
- Inherits:
-
Netfira::WebConnect::RackApp::Action
- Object
- Netfira::WebConnect::RackApp::Action
- Netfira::WebConnect::RackApp::Action::Version8::Web
- Defined in:
- lib/netfira/web_connect/rack_app/actions/version_8/web.rb
Constant Summary collapse
- WEB_BASE =
Netfira::WebConnect::ROOT.parent + 'web'
- SEARCH_PATH =
[:public, :protected].map { |x| [x, WEB_BASE + x.to_s] }.to_h
Constants inherited from Netfira::WebConnect::RackApp::Action
Netfira::WebConnect::RackApp::Action::VALID_BASE64
Instance Attribute Summary
Attributes inherited from Netfira::WebConnect::RackApp::Action
#env, #headers, #input, #path, #query_string, #shop, #timeout, #verb
Instance Method Summary collapse
Methods inherited from Netfira::WebConnect::RackApp::Action
action_classes, #allow, #class_for_record_type, #class_for_relation_type, create, #dispatch_event, #header, #import_env, #initialize, latest_version, #send_file
Constructor Details
This class inherits a constructor from Netfira::WebConnect::RackApp::Action
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/netfira/web_connect/rack_app/actions/version_8/web.rb', line 8 def call allow :get raise NotFound unless path path = self.path.join '/' = SEARCH_PATH.map do |access, dir| ['', '.erb'].map do |extension| [access, dir.join(path + extension)] end end.flatten(1).select { |option| option[1].exist? } raise NotFound if .empty? raise InternalServerError, "Ambiguous file name (#{.length} variations)" unless .length == 1 send_file .first.last end |