Sha256: 9bc3c5aadd2264c590fbf83860822c9f542b57384082e5af52d22ab75f9a2ff4

Contents?: true

Size: 414 Bytes

Versions: 2

Compression:

Stored size: 414 Bytes

Contents

# frozen_string_literal: true

module SteelWheel
  # Base class for commands
  class Command
    include Memery
    include ActiveModel::Validations

    def self.name
      'SteelWheel::Command'
    end

    def http_status
      return :ok if errors.empty?
      return errors.keys.first unless defined?(ActiveModel::Error)

      errors.map(&:type).first
    end

    def call(*)
      # NOOP
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
steel_wheel-0.6.1 lib/steel_wheel/command.rb
steel_wheel-0.6.0 lib/steel_wheel/command.rb