Class: Qrpm::Fragment::CommandFragment
- Inherits:
-
FragmentContainer
- Object
- Fragment
- FragmentContainer
- Qrpm::Fragment::CommandFragment
- Defined in:
- lib/qrpm/fragment.rb
Overview
$(COMMAND)
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Command line excl.
Attributes inherited from Fragment
Instance Method Summary collapse
-
#initialize(string) ⇒ CommandFragment
constructor
A new instance of CommandFragment.
- #interpolate(dict) ⇒ Object
Methods inherited from Fragment
#is_nil?, parse, #signature, #to_s, #variables
Constructor Details
#initialize(string) ⇒ CommandFragment
Returns a new instance of CommandFragment.
148 149 150 151 |
# File 'lib/qrpm/fragment.rb', line 148 def initialize(string) super(string) @command = string[2..-2] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Command line excl. ‘$()’
146 147 148 |
# File 'lib/qrpm/fragment.rb', line 146 def command @command end |
Instance Method Details
#interpolate(dict) ⇒ Object
153 154 155 156 157 158 |
# File 'lib/qrpm/fragment.rb', line 153 def interpolate(dict) cmd = "set -eo pipefail; #{super}" stdout, stderr, status = Open3.capture3(cmd) status == 0 or raise Error.new "Failed expanding '$(#{cmd})'\n#{stderr}" stdout.chomp end |