Class: CfScript::Output
- Inherits:
-
Object
- Object
- CfScript::Output
- Defined in:
- lib/cf_script/output.rb
Defined Under Namespace
Modules: Parser, Tests, Utils Classes: Buffer
Constant Summary
Constants included from Parser::Attributes
Parser::Attributes::ATTRIBUTE_REGEXP
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #attributes ⇒ Object
- #attributes_from(line_start) ⇒ Object
- #err ⇒ Object
- #good? ⇒ Boolean
-
#initialize(command, stdout, stderr, status) ⇒ Output
constructor
A new instance of Output.
- #last_line ⇒ Object
- #line_attributes(line_regexp) ⇒ Object
- #out ⇒ Object
- #section_attributes(header) ⇒ Object
- #table(headers) ⇒ Object
Methods included from Utils
Methods included from Tests
#already_exists?, #authenticated?, #contains?, #credentials_rejected?, #failed?, #is_already?, #matches?, #no_api_endpoint?, #not_authorized?, #not_found?, #not_logged_in?, #ok?
Methods included from Parser::Table
#parse_columns, #parse_row, #parse_rows, #parse_table
Methods included from Parser::Section
#extract_section, #parse_section_attributes
Methods included from Parser::Attributes
#parse_attribute, #parse_attribute_list, #parse_line_attributes
Methods included from Utils
Constructor Details
#initialize(command, stdout, stderr, status) ⇒ Output
Returns a new instance of Output.
19 20 21 22 23 24 |
# File 'lib/cf_script/output.rb', line 19 def initialize(command, stdout, stderr, status) @command = command @stdout = stdout @stderr = stderr @status = status end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
10 11 12 |
# File 'lib/cf_script/output.rb', line 10 def command @command end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'lib/cf_script/output.rb', line 13 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
12 13 14 |
# File 'lib/cf_script/output.rb', line 12 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
11 12 13 |
# File 'lib/cf_script/output.rb', line 11 def stdout @stdout end |
Instance Method Details
#attributes ⇒ Object
42 43 44 |
# File 'lib/cf_script/output.rb', line 42 def attributes parse_attribute_list(out) end |
#attributes_from(line_start) ⇒ Object
50 51 52 |
# File 'lib/cf_script/output.rb', line 50 def attributes_from(line_start) parse_attribute_list(out.from(line_start)) end |
#err ⇒ Object
34 35 36 |
# File 'lib/cf_script/output.rb', line 34 def err @sane_stderr ||= Buffer.new(stderr) end |
#good? ⇒ Boolean
26 27 28 |
# File 'lib/cf_script/output.rb', line 26 def good? status.success? && status.exitstatus == 0 end |
#last_line ⇒ Object
38 39 40 |
# File 'lib/cf_script/output.rb', line 38 def last_line out.last_line end |
#line_attributes(line_regexp) ⇒ Object
46 47 48 |
# File 'lib/cf_script/output.rb', line 46 def line_attributes(line_regexp) parse_line_attributes(out, line_regexp) end |
#out ⇒ Object
30 31 32 |
# File 'lib/cf_script/output.rb', line 30 def out @sane_stdout ||= Buffer.new(stdout) end |
#section_attributes(header) ⇒ Object
58 59 60 |
# File 'lib/cf_script/output.rb', line 58 def section_attributes(header) parse_section_attributes(out, header) end |
#table(headers) ⇒ Object
54 55 56 |
# File 'lib/cf_script/output.rb', line 54 def table(headers) parse_table(out, headers) end |