Module: Lux::Application::Shared
- Included in:
- Lux::Application, Controller
- Defined in:
- lib/lux/application/lib/shared.rb
Instance Method Summary collapse
- #body? ⇒ Boolean
- #current ⇒ Object
- #nav ⇒ Object
- #params(opts = nil, &block) ⇒ Object
- #redirect_to(where, flash = {}) ⇒ Object
- #request ⇒ Object
- #response ⇒ Object
- #session ⇒ Object
- #user ⇒ Object
Instance Method Details
#body? ⇒ Boolean
34 35 36 |
# File 'lib/lux/application/lib/shared.rb', line 34 def body? Lux.current.response.body? end |
#current ⇒ Object
4 5 6 |
# File 'lib/lux/application/lib/shared.rb', line 4 def current Lux.current end |
#nav ⇒ Object
30 31 32 |
# File 'lib/lux/application/lib/shared.rb', line 30 def nav Lux.current.nav end |
#params(opts = nil, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/lux/application/lib/shared.rb', line 20 def params opts=nil, &block if block_given? Typero.schema(&block).validate Lux.current.request.params, opts do |field, error| error 'Parameter "%s" error: %s' % [field, error] end end Lux.current.params end |
#redirect_to(where, flash = {}) ⇒ Object
38 39 40 |
# File 'lib/lux/application/lib/shared.rb', line 38 def redirect_to where, flash = {} Lux.current.response.redirect_to where, flash end |
#request ⇒ Object
8 9 10 |
# File 'lib/lux/application/lib/shared.rb', line 8 def request Lux.current.request end |
#response ⇒ Object
12 13 14 |
# File 'lib/lux/application/lib/shared.rb', line 12 def response Lux.current.response end |
#session ⇒ Object
16 17 18 |
# File 'lib/lux/application/lib/shared.rb', line 16 def session Lux.current.session end |
#user ⇒ Object
42 43 44 |
# File 'lib/lux/application/lib/shared.rb', line 42 def user User.current end |