Sha256: 0f50dc3c2da87f5f5ad235466101c9058efd295dad55a933fdb2c70cf6e314d9

Contents?: true

Size: 770 Bytes

Versions: 8

Compression:

Stored size: 770 Bytes

Contents

class ProconBypassMan::RemoteAction::RemoteActionObject
  # valueobjectがvalidatorの責務も持っている. 今度分離する
  class ValidationError < StandardError; end
  class MustBeNotNilError < ValidationError; end
  class NonSupportAction < ValidationError; end

  attr_accessor :name, :uuid, :steps

  # @param [String] name
  # @param [String] uuid
  # @param [Array] steps
  def initialize(name: , uuid:, steps: )
    @name = name
    @uuid = uuid
    @steps = steps
    freeze
  end

  # @raise [MustBeNotNilError]
  # @raise [NonSupportAction]
  # @return [void]
  def validate!
    self.uuid or raise MustBeNotNilError, "uuidは値が必須です"
    unless self.steps.is_a?(Array)
      raise ValidationError, "stepsは配列です"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/remote_action/remote_action_object.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/remote_action/remote_action_object.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/remote_action/remote_action_object.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/remote_action/remote_action_object.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/remote_action/remote_action_object.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/remote_action/remote_action_object.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/remote_action/remote_action_object.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/remote_action/remote_action_object.rb