Class: Swamp::Action::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/swamp/rails_actions/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object (protected)



47
48
49
# File 'lib/swamp/rails_actions/action.rb', line 47

def method_missing(method_name, *)
  exposures.fetch(method_name) { super }
end

Instance Attribute Details

#redirection_optionsObject (readonly)

Returns the value of attribute redirection_options.



17
18
19
# File 'lib/swamp/rails_actions/action.rb', line 17

def redirection_options
  @redirection_options
end

#redirection_pathObject (readonly)

Returns the value of attribute redirection_path.



17
18
19
# File 'lib/swamp/rails_actions/action.rb', line 17

def redirection_path
  @redirection_path
end

#templateObject (readonly)

Returns the value of attribute template.



17
18
19
# File 'lib/swamp/rails_actions/action.rb', line 17

def template
  @template
end

Instance Method Details

#exposuresObject



41
42
43
# File 'lib/swamp/rails_actions/action.rb', line 41

def exposures
  @exposures ||= Hash[]
end

#prepare!(payload) ⇒ Object



28
29
30
31
# File 'lib/swamp/rails_actions/action.rb', line 28

def prepare!(payload)
  exposures.merge!(payload)
  self
end

#redirect?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/swamp/rails_actions/action.rb', line 33

def redirect?
  !redirection_path.nil?
end

#redirect_to(path, **options) ⇒ Object



23
24
25
26
# File 'lib/swamp/rails_actions/action.rb', line 23

def redirect_to(path, **options)
  @redirection_path = path
  @redirection_options = options
end

#render(template) ⇒ Object



19
20
21
# File 'lib/swamp/rails_actions/action.rb', line 19

def render(template)
  @template = template
end

#render?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/swamp/rails_actions/action.rb', line 37

def render?
  !template.nil?
end