Sha256: 5766a21dfe65a9ac6437f8e6555480216c91914d93ca14d6463ca13bc2b8d340

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

module SSHTunnel
  module UI
    module Forms
      class TunnelForm < ApplicationForm

        attribute :name,        required: true
        attribute :type,        required: true
        attribute :local_host,  required: true
        attribute :local_port,  required: true
        attribute :remote_host, required: true
        attribute :remote_port, required: true
        attribute :auto_start

        validates_inclusion_of :local_port,  in: 0..65_535
        validates_inclusion_of :remote_port, in: 0..65_535

        # Callbacks
        before_validation :cast_port_to_int


        def cast_port_to_int
          self.local_port  = cast_to_int(local_port)
          self.remote_port = cast_to_int(remote_port)
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ssh-hull-2.0 lib/ssh-hull/ui/forms/tunnel_form.rb
ssh-hull-1.0.0 lib/ssh-hull/ui/forms/tunnel_form.rb