Class: Memoh::Models::SSHMemo
- Inherits:
-
Object
- Object
- Memoh::Models::SSHMemo
- Includes:
- ActiveModel::Attributes, ActiveModel::Dirty, ActiveModel::Model, ActiveModel::Serializers::JSON, ActiveModel::Validations::Callbacks, Concerns::Persistence
- Defined in:
- lib/memoh/models/ssh_memo.rb
Overview
:nodoc:
Constant Summary collapse
- ALLOWED_COLORS =
String.colors.map(&:to_s) - %w[black default]
Class Method Summary collapse
-
.questions_map ⇒ Object
rubocop:disable Metrics/LineLength.
Instance Method Summary collapse
Methods included from Concerns::Persistence
Class Method Details
.questions_map ⇒ Object
rubocop:disable Metrics/LineLength
36 37 38 39 40 41 42 43 44 |
# File 'lib/memoh/models/ssh_memo.rb', line 36 def questions_map [ { attribute: :host, question: "Enter the IP address or hostname:" }, { attribute: :username, question: "Enter the username:" }, { attribute: :identity_file, question: "Enter the path to the SSH key used for this host:" }, { attribute: :name, question: "Choose a name for your SSH memo (you'll use this name to connect to your host):" }, { attribute: :color, question: "Choose a color for your SSH memo:\n(#{ALLOWED_COLORS.map { |color| color.send(color) }.join("/")})" } ] end |
Instance Method Details
#connection_string ⇒ Object
52 53 54 |
# File 'lib/memoh/models/ssh_memo.rb', line 52 def connection_string "ssh #{username}@#{host} -i #{identity_file}" end |
#display_details ⇒ Object
48 49 50 |
# File 'lib/memoh/models/ssh_memo.rb', line 48 def display_details "Name: #{name}, Host: #{host}".send(color) end |