Module: Peck::Rails::Controller::Helpers

Defined in:
lib/peck_on_rails/controller.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject


70
71
72
# File 'lib/peck_on_rails/controller.rb', line 70

def body
  Peck::Rails::Controller::Body.new(@response)
end

#immediate_values(params) ⇒ Object

Interpret the non-immediate values in params and replace them


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/peck_on_rails/controller.rb', line 75

def immediate_values(params)
  result = {}
  params.each do |key, value|
    result[key] = case value
    when Hash
      immediate_values(value)
    when ::Peck::Rails::Controller::LazyValue
      value.to_param(self)
    when Proc
      value.call
    else
      value
    end
  end
  result
end

#statusObject


60
61
62
# File 'lib/peck_on_rails/controller.rb', line 60

def status
  Peck::Rails::Controller::Status.new(@response)
end

#templatesObject


64
65
66
67
68
# File 'lib/peck_on_rails/controller.rb', line 64

def templates
  # Force body to be read in case the template is being streamed
  response.body
  (@templates || @_templates).keys
end