Sha256: 992db798f2e3690af1c6c637c910dda3a4ae9cc384f330b2788ed687f30a9930

Contents?: true

Size: 815 Bytes

Versions: 5

Compression:

Stored size: 815 Bytes

Contents

module ProconBypassMan
  class 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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
procon_bypass_man-0.2.2 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.2.1 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.2.0 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.1.23 lib/procon_bypass_man/remote_macro/remote_macro_object.rb
procon_bypass_man-0.1.22 lib/procon_bypass_man/remote_macro/remote_macro_object.rb