Top Level Namespace
Defined Under Namespace
Instance Method Summary collapse
- #_(str) ⇒ Object
-
#_buf ⇒ Object
This function makes it possible to define methods in ERubis-parsed files (else _buf-variable wouldnt be globally available).
- #_cookie ⇒ Object
- #_db ⇒ Object
- #_get ⇒ Object
- #_hb ⇒ Object
- #_httpsession ⇒ Object
- #_httpsession_var ⇒ Object
- #_meta ⇒ Object
- #_post ⇒ Object
- #_request_hash ⇒ Object
- #_requestdata ⇒ Object
- #_server ⇒ Object
- #_session ⇒ Object
- #_session_hash ⇒ Object
- #_session_obj ⇒ Object
- #_vars ⇒ Object
Instance Method Details
#_(str) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kernel_ext/gettext_methods.rb', line 3 def _(str) thread = Thread.current thread_hayabusa = thread[:hayabusa] raise "Could not register Hayabusa-data." if !thread_hayabusa hb = thread_hayabusa[:hb] raise "Could not register Hayabusa." if !hb raise "'gettext' not enabled for Hayabusa." if !hb.gettext session = thread_hayabusa[:session].sess_data if thread_hayabusa[:session] locale = nil if !thread[:locale].to_s.empty? locale = thread[:locale] elsif session and !session[:locale].to_s.strip.empty? locale = session[:locale] elsif hb and !hb.config[:locale_default].to_s.strip.empty? session[:locale] = hb.config[:locale_default] if session locale = hb.config[:locale_default] elsif !session and !hb return str else raise "No locale set for session and ':locale_default' not set in config." end return hb.gettext.trans(locale, str) end |
#_buf ⇒ Object
This function makes it possible to define methods in ERubis-parsed files (else _buf-variable wouldnt be globally available).
63 64 65 |
# File 'lib/kernel_ext/magic_methods.rb', line 63 def _buf return $stdout end |
#_cookie ⇒ Object
1 2 3 |
# File 'lib/kernel_ext/magic_methods.rb', line 1 def return Thread.current[:hayabusa][:cookie] if Thread.current[:hayabusa] end |
#_db ⇒ Object
57 58 59 60 |
# File 'lib/kernel_ext/magic_methods.rb', line 57 def _db return Thread.current[:hayabusa][:db] if Thread.current[:hayabusa] and Thread.current[:hayabusa][:db] #This is the default use from a .rhtml-file. return Thread.current[:hayabusa][:hb].db_handler if Thread.current[:hayabusa] and Thread.current[:hayabusa][:hb] #This is useually used when using autoload-argument for the appserver. end |
#_get ⇒ Object
5 6 7 |
# File 'lib/kernel_ext/magic_methods.rb', line 5 def _get return Thread.current[:hayabusa][:get] if Thread.current[:hayabusa] end |
#_hb ⇒ Object
49 50 51 |
# File 'lib/kernel_ext/magic_methods.rb', line 49 def _hb return Thread.current[:hayabusa][:hb] if Thread.current[:hayabusa] end |
#_httpsession ⇒ Object
33 34 35 |
# File 'lib/kernel_ext/magic_methods.rb', line 33 def _httpsession return Thread.current[:hayabusa][:httpsession] if Thread.current[:hayabusa] end |
#_httpsession_var ⇒ Object
37 38 39 |
# File 'lib/kernel_ext/magic_methods.rb', line 37 def _httpsession_var return Thread.current[:hayabusa][:httpsession].httpsession_var if Thread.current[:hayabusa] end |
#_meta ⇒ Object
13 14 15 |
# File 'lib/kernel_ext/magic_methods.rb', line 13 def return Thread.current[:hayabusa][:meta] if Thread.current[:hayabusa] end |
#_post ⇒ Object
9 10 11 |
# File 'lib/kernel_ext/magic_methods.rb', line 9 def _post return Thread.current[:hayabusa][:post] if Thread.current[:hayabusa] end |
#_request_hash ⇒ Object
45 46 47 |
# File 'lib/kernel_ext/magic_methods.rb', line 45 def _request_hash return Thread.current[:hayabusa][:httpsession].request_hash if Thread.current[:hayabusa] end |
#_requestdata ⇒ Object
41 42 43 |
# File 'lib/kernel_ext/magic_methods.rb', line 41 def _requestdata return Thread.current[:hayabusa] if Thread.current[:hayabusa] end |
#_server ⇒ Object
17 18 19 |
# File 'lib/kernel_ext/magic_methods.rb', line 17 def _server return Thread.current[:hayabusa][:meta] if Thread.current[:hayabusa] end |
#_session ⇒ Object
21 22 23 |
# File 'lib/kernel_ext/magic_methods.rb', line 21 def _session return Thread.current[:hayabusa][:session].sess_data if Thread.current[:hayabusa] and Thread.current[:hayabusa][:session] end |
#_session_hash ⇒ Object
25 26 27 |
# File 'lib/kernel_ext/magic_methods.rb', line 25 def _session_hash return Thread.current[:hayabusa][:session].edata if Thread.current[:hayabusa] and Thread.current[:hayabusa][:session] end |
#_session_obj ⇒ Object
29 30 31 |
# File 'lib/kernel_ext/magic_methods.rb', line 29 def _session_obj return Thread.current[:hayabusa][:session] if Thread.current[:hayabusa] and Thread.current[:hayabusa][:session] end |
#_vars ⇒ Object
53 54 55 |
# File 'lib/kernel_ext/magic_methods.rb', line 53 def _vars return Thread.current[:hayabusa][:hb].vars if Thread.current[:hayabusa] end |