Sha256: d267fbfb5f7b2a213695e2f779f938c6c9d35deb592954fb47a82f90d78968c8

Contents?: true

Size: 652 Bytes

Versions: 18

Compression:

Stored size: 652 Bytes

Contents

class Flexite::ActionService::Result
  attr_accessor :options

  def initialize(options = {})
    @options = options
    @errors = ::Hash.new { |h, k| h[k] = [] }
  end

  def succeed?
    @options.fetch(:success, true)
  end

  def failed?
    !succeed?
  end

  def render?
    @options.fetch(:render, true)
  end

  def redirect?
    !render?
  end

  def data
    @options[:data]
  end

  alias :record :data

  def add_error(name, value)
    @errors[name] << value
  end

  def add_errors(name, values)
    @errors[name] += values
  end

  def endpoint
    @options.fetch(:endpoint, {})
  end

  def flash
    @options.fetch(:flash, {})
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
flexite-0.0.25 app/services/flexite/action_service/result.rb
flexite-0.0.24 app/services/flexite/action_service/result.rb
flexite-0.0.23 app/services/flexite/action_service/result.rb
flexite-0.0.22 app/services/flexite/action_service/result.rb
flexite-0.0.21 app/services/flexite/action_service/result.rb
flexite-0.0.20 app/services/flexite/action_service/result.rb
flexite-0.0.19 app/services/flexite/action_service/result.rb
flexite-0.0.18 app/services/flexite/action_service/result.rb
flexite-0.0.17 app/services/flexite/action_service/result.rb
flexite-0.0.16 app/services/flexite/action_service/result.rb
flexite-0.0.15 app/services/flexite/action_service/result.rb
flexite-0.0.14 app/services/flexite/action_service/result.rb
flexite-0.0.13 app/services/flexite/action_service/result.rb
flexite-0.0.12 app/services/flexite/action_service/result.rb
flexite-0.0.11 app/services/flexite/action_service/result.rb
flexite-0.0.10 app/services/flexite/action_service/result.rb
flexite-0.0.9 app/services/flexite/action_service/result.rb
flexite-0.0.8 app/services/flexite/action_service/result.rb