Class: UniversalPipeHandler::Base
- Inherits:
-
Object
- Object
- UniversalPipeHandler::Base
show all
- Includes:
- Colours
- Defined in:
- lib/universal_pipe_handler/base/base.rb
Overview
UniversalPipeHandler::Base
Constant Summary
collapse
- NAMESPACE =
inspect
Class Method Summary
collapse
-
.[](i = '') ⇒ Object
# === UniversalPipeHandler::Base[] ========================================================================= #.
Instance Method Summary
collapse
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ Base
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/universal_pipe_handler/base/base.rb', line 34
def initialize(
commandline_arguments = nil,
run_already = true
)
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
#
UniversalPipeHandler::Base[]
#
139
140
141
|
# File 'lib/universal_pipe_handler/base/base.rb', line 139
def self.[](i = '')
new(i)
end
|
Instance Method Details
#allowed_actions? ⇒ Boolean
Also known as:
registered_actions?
#
allowed_actions?
Return every allowed action. This will not be needed by every subclass, so perhaps this may have to be changed at one point in time.
#
#chdir(i) ⇒ Object
Also known as:
cd
112
113
114
|
# File 'lib/universal_pipe_handler/base/base.rb', line 112
def chdir(i)
FileUtils.chdir(i)
end
|
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
#
66
67
68
|
# File 'lib/universal_pipe_handler/base/base.rb', line 66
def commandline_arguments?
@commandline_arguments
end
|
#copy(from, to) ⇒ Object
91
92
93
|
# File 'lib/universal_pipe_handler/base/base.rb', line 91
def copy(from, to)
FileUtils.copy(from, to)
end
|
#first_argument? ⇒ Boolean
Also known as:
first?
73
74
75
|
# File 'lib/universal_pipe_handler/base/base.rb', line 73
def first_argument?
@commandline_arguments.first
end
|
#mkdir(i) ⇒ Object
105
106
107
|
# File 'lib/universal_pipe_handler/base/base.rb', line 105
def mkdir(i)
FileUtils.mkdir_p(i)
end
|
#register_sigint ⇒ Object
119
120
121
|
# File 'lib/universal_pipe_handler/base/base.rb', line 119
def register_sigint
Signal.trap('SIGINT') { exit }
end
|
#remove_quotes(i) ⇒ Object
98
99
100
|
# File 'lib/universal_pipe_handler/base/base.rb', line 98
def remove_quotes(i)
i.delete('"')
end
|
#reset ⇒ Object
48
49
50
51
52
53
|
# File 'lib/universal_pipe_handler/base/base.rb', line 48
def reset
@namespace = NAMESPACE
end
|
#return_pwd ⇒ Object
132
133
134
|
# File 'lib/universal_pipe_handler/base/base.rb', line 132
def return_pwd
"#{Dir.pwd}/".squeeze('')
end
|
#run ⇒ Object
126
127
|
# File 'lib/universal_pipe_handler/base/base.rb', line 126
def run
end
|
#set_commandline_arguments(i = '') ⇒ Object
#
set_commandline_arguments
#
58
59
60
61
|
# File 'lib/universal_pipe_handler/base/base.rb', line 58
def set_commandline_arguments(i = '')
i = [i].flatten.compact
@commandline_arguments = i
end
|