Class: Deplo::FromCommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/deplo/from_command_line.rb

Direct Known Subclasses

BranchNameForGithub, TitleForGitCommit

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: nil, message: nil, content: nil) ⇒ FromCommandLine

Returns a new instance of FromCommandLine.



3
4
5
6
7
8
9
# 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

Class Method Details

.set(*opt) ⇒ Object



23
24
25
# File 'lib/deplo/from_command_line.rb', line 23

def self.set( *opt )
  self.new( *opt ).set
end

Instance Method Details

#set ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# 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