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

Defined in:
lib/peck_on_rails.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject



120
121
122
# File 'lib/peck_on_rails.rb', line 120

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

#immediate_values(params) ⇒ Object

Interpret the non-immediate values in params and replace them



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/peck_on_rails.rb', line 125

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



110
111
112
# File 'lib/peck_on_rails.rb', line 110

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

#templatesObject



114
115
116
117
118
# File 'lib/peck_on_rails.rb', line 114

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