Class: SysCmd::Shell
- Inherits:
-
Object
- Object
- SysCmd::Shell
- Defined in:
- lib/sys_cmd.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #applicable?(options = {}) ⇒ Boolean
- #escape(text) ⇒ Object
- #escape_filename(name) ⇒ Object
- #escape_value(value) ⇒ Object
-
#initialize(options = {}) ⇒ Shell
constructor
A new instance of Shell.
- #line_separator ⇒ Object
- #option_switch ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Shell
Returns a new instance of Shell.
328 329 330 |
# File 'lib/sys_cmd.rb', line 328 def initialize( = {}) @type = SysCmd.os_type() end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
332 333 334 |
# File 'lib/sys_cmd.rb', line 332 def type @type end |
Instance Method Details
#applicable?(options = {}) ⇒ Boolean
354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/sys_cmd.rb', line 354 def applicable?( = {}) applicable = true only_on = Array([:only_on]) unless only_on.empty? applicable = false unless only_on.include?(@type) end except_on = Array([:except_on]) unless except_on.empty? applicable = false if except_on.include?(@type) end applicable end |
#escape(text) ⇒ Object
334 335 336 |
# File 'lib/sys_cmd.rb', line 334 def escape(text) SysCmd.escape(text, os: @type) end |
#escape_filename(name) ⇒ Object
338 339 340 |
# File 'lib/sys_cmd.rb', line 338 def escape_filename(name) escape name end |
#escape_value(value) ⇒ Object
342 343 344 |
# File 'lib/sys_cmd.rb', line 342 def escape_value(value) escape value.to_s end |
#line_separator ⇒ Object
346 347 348 |
# File 'lib/sys_cmd.rb', line 346 def line_separator SysCmd.line_separator(os: @type) end |
#option_switch ⇒ Object
350 351 352 |
# File 'lib/sys_cmd.rb', line 350 def option_switch SysCmd.option_switch(os: @type) end |