Module: Hanami::Extensions::Action::InstanceMethods

Defined in:
lib/hanami/extensions/action.rb

Overview

Instance methods for app-integrated actions.

Since:

  • 2.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#i18nHanami::Providers::I18n::Backend (readonly)

Returns the slice's i18n backend.

Returns:

Since:

  • x.x.x



68
69
70
# File 'lib/hanami/extensions/action.rb', line 68

def i18n
  @i18n
end

#rack_monitorDry::Monitor::Rack::Middleware (readonly)

Returns the slice's Dry::Monitor::Rack::Middleware.

Returns:

  • (Dry::Monitor::Rack::Middleware)

Since:

  • 2.0.0



60
61
62
# File 'lib/hanami/extensions/action.rb', line 60

def rack_monitor
  @rack_monitor
end

#routesHanami::Slice::RoutesHelper (readonly)

Returns the slice's RoutesHelper.

Returns:

Since:

  • 2.0.0



52
53
54
# File 'lib/hanami/extensions/action.rb', line 52

def routes
  @routes
end

#viewObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



41
42
43
# File 'lib/hanami/extensions/action.rb', line 41

def view
  @view
end

#view_context_classObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



44
45
46
# File 'lib/hanami/extensions/action.rb', line 44

def view_context_class
  @view_context_class
end

Instance Method Details

#initialize(routes: nil, **kwargs) ⇒ Object

Returns a new Hanami::Action with app components injected as dependencies.

These dependencies are injected automatically so that a call to .new (with no arguments) returns a fully integrated action.

Parameters:

Since:

  • 2.0.0

Since:

  • 2.0.0



80
81
82
83
84
85
86
87
88
# File 'lib/hanami/extensions/action.rb', line 80

def initialize(view: nil, view_context_class: nil, rack_monitor: nil, routes: nil, i18n: nil, **kwargs)
  @view = view
  @view_context_class = view_context_class
  @routes = routes
  @rack_monitor = rack_monitor
  @i18n = i18n

  super(**kwargs)
end