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
- #here_doc(data, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Shell
constructor
A new instance of Shell.
- #line_separator ⇒ Object
- #option_switch ⇒ Object
- #requires_escaping?(text) ⇒ Boolean
- #split(text) ⇒ Object
Constructor Details
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
441 442 443 |
# File 'lib/sys_cmd.rb', line 441 def type @type end |
Instance Method Details
#applicable?(options = {}) ⇒ Boolean
474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/sys_cmd.rb', line 474 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
443 444 445 |
# File 'lib/sys_cmd.rb', line 443 def escape(text) SysCmd.escape(text, os: @type) end |
#escape_filename(name) ⇒ Object
455 456 457 458 459 460 |
# File 'lib/sys_cmd.rb', line 455 def escape_filename(name) if @type == :windows name = name.gsub('/', '\\') end escape name end |
#escape_value(value) ⇒ Object
462 463 464 |
# File 'lib/sys_cmd.rb', line 462 def escape_value(value) escape value.to_s end |
#here_doc(data, options = {}) ⇒ Object
487 488 489 |
# File 'lib/sys_cmd.rb', line 487 def here_doc(data, = {}) SysCmd.here_doc(data, .merge(os: @type)) end |
#line_separator ⇒ Object
466 467 468 |
# File 'lib/sys_cmd.rb', line 466 def line_separator SysCmd.line_separator(os: @type) end |
#option_switch ⇒ Object
470 471 472 |
# File 'lib/sys_cmd.rb', line 470 def option_switch SysCmd.option_switch(os: @type) end |
#requires_escaping?(text) ⇒ Boolean
447 448 449 |
# File 'lib/sys_cmd.rb', line 447 def requires_escaping?(text) SysCmd.requires_escaping?(text, os: @type) end |