class Paradeiser::Controller

Attributes

args[R]
exitstatus[RW]
has_output[RW]
options[R]

Public Class Methods

new(method) click to toggle source
# File lib/paradeiser/controllers/controller.rb, line 5
def initialize(method)
  @method = method
  @exitstatus = 0
  @has_output = false
  @already_rendered = nil
end

Public Instance Methods

call(args, options) click to toggle source
# File lib/paradeiser/controllers/controller.rb, line 12
def call(args, options)
  @args = args
  @options = options
  send(@method)
  render
end
get_binding() click to toggle source
# File lib/paradeiser/controllers/controller.rb, line 23
def get_binding
  return binding
end
model() click to toggle source
# File lib/paradeiser/controllers/controller.rb, line 19
def model
  self.class.name.split("::").last.sub('Controller', '')
end
render(options = {}) click to toggle source
# File lib/paradeiser/controllers/controller.rb, line 27
def render(options = {})
  return if @already_rendered # render only once
  return unless (@options && @options.verbose) || has_output

  if options.has_key?(:text)
    puts options[:text]
  else
    puts View.new(model, @method).render(binding)
  end

  @already_rendered = true
end