Class: Limbo::Rails::Data
- Inherits:
-
Object
- Object
- Limbo::Rails::Data
- Defined in:
- lib/limbo/rails/data.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ Data
constructor
A new instance of Data.
- #transform ⇒ Object
Constructor Details
#initialize(hash) ⇒ Data
Returns a new instance of Data.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/limbo/rails/data.rb', line 7 def initialize(hash) fail ArgumentError, 'Argument must be a hash' unless hash.is_a?(Hash) = 'Required keys are: :params, :session, :exception, :request' @params = hash.delete(:params) { fail ArgumentError, } @session = hash.delete(:session) { fail ArgumentError, } @exception = hash.delete(:exception) { fail ArgumentError, } request = hash.delete(:request) { fail ArgumentError, } @request = Limbo::Rails::Request.new(request) @hash = hash end |
Instance Method Details
#transform ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/limbo/rails/data.rb', line 21 def transform { controller: @params[:controller], action: @params[:action], parameters: Limbo::Rails::ParameterFilter.filter(@params), url: @request.url, session: Limbo::Rails::ParameterFilter.filter(@session.to_hash), # TODO: We must filter this better. # request_env: Limbo::RailsParameterFilter.filter(@request.env) backtrace: @exception.backtrace, exception_message: @exception. }.merge(@hash) end |