class Deplo::FromCommandLine

Public Class Methods

new( title: nil , message: nil , content: nil ) click to toggle source
# File lib/deplo/from_command_line.rb, line 3
def initialize( title: nil , message: nil , content: nil )
  raise "Error" if [ title , message ].all?( &:nil? )
  @title = title
  @msg = message
  @content = content
  @condition = false
end
set( *opt ) click to toggle source
# File lib/deplo/from_command_line.rb, line 23
def self.set( *opt )
  self.new( *opt ).set
end

Public Instance Methods

set() click to toggle source
# File lib/deplo/from_command_line.rb, line 11
def set
  while !( @condition )
    puts @msg
    a = ::STDIN.gets.chomp
    @content = a
    puts message_after_input_string
    @condition = ::Deplo.yes_no( @condition )
  end

  actual_content
end

Private Instance Methods

actual_content() click to toggle source
# File lib/deplo/from_command_line.rb, line 33
def actual_content
  @content
end
message_after_input_string() click to toggle source
# File lib/deplo/from_command_line.rb, line 29
def message_after_input_string
  "#{ @title }: \'#{ actual_content }\'"
end