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
- #split(text) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Shell
Returns a new instance of Shell.
377 378 379 |
# File 'lib/sys_cmd.rb', line 377 def initialize( = {}) @type = SysCmd.os_type() end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
381 382 383 |
# File 'lib/sys_cmd.rb', line 381 def type @type end |
Instance Method Details
#applicable?(options = {}) ⇒ Boolean
407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/sys_cmd.rb', line 407 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
383 384 385 |
# File 'lib/sys_cmd.rb', line 383 def escape(text) SysCmd.escape(text, os: @type) end |
#escape_filename(name) ⇒ Object
391 392 393 |
# File 'lib/sys_cmd.rb', line 391 def escape_filename(name) escape name end |
#escape_value(value) ⇒ Object
395 396 397 |
# File 'lib/sys_cmd.rb', line 395 def escape_value(value) escape value.to_s end |
#line_separator ⇒ Object
399 400 401 |
# File 'lib/sys_cmd.rb', line 399 def line_separator SysCmd.line_separator(os: @type) end |
#option_switch ⇒ Object
403 404 405 |
# File 'lib/sys_cmd.rb', line 403 def option_switch SysCmd.option_switch(os: @type) end |
#split(text) ⇒ Object
387 388 389 |
# File 'lib/sys_cmd.rb', line 387 def split(text) SysCmd.split(text, os: @type) end |