Class: Clin::ShellInteraction

Inherits:
Object
  • Object
show all
Defined in:
lib/clin/shell_interaction.rb

Overview

Parent class for shell interaction.

Direct Known Subclasses

Choose, FileConflict, YesOrNo

Defined Under Namespace

Classes: Choose, FileConflict, Select, YesOrNo

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell) ⇒ ShellInteraction

Returns a new instance of ShellInteraction.

Parameters:

  • shell (Clin::Shell)

    Shell starting the interaction.



12
13
14
15
# File 'lib/clin/shell_interaction.rb', line 12

def initialize(shell)
  @shell = shell
  self.class.persist ||= {}
end

Class Attribute Details

.persistObject

Returns the value of attribute persist.



6
7
8
# File 'lib/clin/shell_interaction.rb', line 6

def persist
  @persist
end

Instance Attribute Details

#shellObject

Returns the value of attribute shell.



9
10
11
# File 'lib/clin/shell_interaction.rb', line 9

def shell
  @shell
end

Instance Method Details

#persist!Object

Mark the current shell to persist file interaction



23
24
25
# File 'lib/clin/shell_interaction.rb', line 23

def persist!
  self.class.persist[@shell] = persist_answer
end

#persist?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/clin/shell_interaction.rb', line 18

def persist?
  self.class.persist[@shell] ||= false
end

#persist_answerObject



27
28
29
# File 'lib/clin/shell_interaction.rb', line 27

def persist_answer
  true
end