Class: Stasis::Action

Inherits:
Scope
  • Object
show all
Defined in:
lib/stasis/scope/action.rb

Instance Attribute Summary collapse

Attributes inherited from Scope

#_stasis

Instance Method Summary collapse

Methods inherited from Scope

#_bind_plugin, #_each_plugin_method, #_each_plugins_method, #_send_to_plugin

Constructor Details

#initialize(stasis, options = {}) ⇒ Action

Returns a new instance of Action.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/stasis/scope/action.rb', line 19

def initialize(stasis, options={})
  @_stasis = stasis
  @params = options[:params] || {}

  @params = @params.inject({}) do |options, (key, value)|
    options[(key.to_sym rescue key) || key] = value
    options
  end

  # Some plugins define methods to be made available to action scopes. This call
  # binds those methods.
  @_stasis.plugins.each do |plugin|
    _bind_plugin(plugin, :action_method)
  end
end

Instance Attribute Details

#_layoutObject

‘String` – Path to the layout for this action.



10
11
12
# File 'lib/stasis/scope/action.rb', line 10

def _layout
  @_layout
end

#_renderObject

‘String` – If present, render this path instead of the default.



13
14
15
# File 'lib/stasis/scope/action.rb', line 13

def _render
  @_render
end

#paramsObject

‘Hash` – Parameters to be made available to the scope, usually through `Stasis::Server`.



17
18
19
# File 'lib/stasis/scope/action.rb', line 17

def params
  @params
end