Sha256: d9551f12d3c7fda18034ad751caf2cdc924cbb42bb6ff88f458a4f34a1c2ccd1

Contents?: true

Size: 768 Bytes

Versions: 8

Compression:

Stored size: 768 Bytes

Contents

class ProconBypassMan::RemoteMacro::RemoteMacroObject
  # 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.5 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/remote_macro/remote_macro_object.rb