Class: OhMyLog::Log::Request
- Inherits:
-
Object
- Object
- OhMyLog::Log::Request
- Defined in:
- lib/oh_my_log/request.rb
Overview
the request is what the user is trying to do
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(args) ⇒ Request
constructor
A new instance of Request.
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 12 13 |
# File 'lib/oh_my_log/request.rb', line 7 def initialize(args) @sender = args[:sender] @date = args[:date] @params = args[:params] @method = args[:method] @status = args[:status] end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'lib/oh_my_log/request.rb', line 5 def date @date end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
5 6 7 |
# File 'lib/oh_my_log/request.rb', line 5 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/oh_my_log/request.rb', line 5 def params @params end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
5 6 7 |
# File 'lib/oh_my_log/request.rb', line 5 def sender @sender end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/oh_my_log/request.rb', line 5 def status @status end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 19 |
# File 'lib/oh_my_log/request.rb', line 15 def to_s user_info = @sender.try(:email) sender = !user_info.blank? ? user_info : Thread.current["remote_ip"] "#{@date}, #{sender}, #{@method}, #{@params}, #{@status}" end |