Module: Quorum::Sequence::SendSequence

Included in:
ApplicationController
Defined in:
lib/quorum/sequence.rb

Overview

Send sequence data to the browser.

Instance Method Summary collapse

Instance Method Details

#has_error?Boolean

Returns:

  • (Boolean)


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

def has_error?
  @data.result.downcase.include?("error")
end

#render_emptyObject



118
119
120
# File 'lib/quorum/sequence.rb', line 118

def render_empty
  render :text => ""
end

#render_errorObject



114
115
116
# File 'lib/quorum/sequence.rb', line 114

def render_error
  render :text => @data.result
end

#sequence(data) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/quorum/sequence.rb', line 95

def sequence(data)
  @data = data
  if @data.respond_to?(:succeeded?) && @data.succeeded?
    if self.has_error?
      return self.render_error
    else
      return send_data @data.result,
        :filename     => @data.meta_id,
        :type         => "text/plain",
        :disposition  => "attachment"
    end
  end
  self.render_empty
end