Class: Xavius::Actions::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/xavius/actions/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**params) ⇒ Context

Returns a new instance of Context.



6
7
8
9
10
# File 'lib/xavius/actions/context.rb', line 6

def initialize(**params)
  @resource         = params.fetch(:resource)
  @resource_class   = @resource.class
  @resource_params  = params.fetch(:resource_params)
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



4
5
6
# File 'lib/xavius/actions/context.rb', line 4

def resource
  @resource
end

#resource_classObject (readonly)

Returns the value of attribute resource_class.



4
5
6
# File 'lib/xavius/actions/context.rb', line 4

def resource_class
  @resource_class
end

Instance Method Details

#resource_paramsObject



12
13
14
# File 'lib/xavius/actions/context.rb', line 12

def resource_params
  @resource_params.call
end