Class: Toolchest::RSpec::ToolResponse
- Inherits:
-
Object
- Object
- Toolchest::RSpec::ToolResponse
- Defined in:
- lib/toolchest/rspec.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #content ⇒ Object
- #error? ⇒ Boolean
-
#initialize(raw) ⇒ ToolResponse
constructor
A new instance of ToolResponse.
- #success? ⇒ Boolean
- #suggests?(tool_name) ⇒ Boolean
- #text ⇒ Object
Constructor Details
#initialize(raw) ⇒ ToolResponse
Returns a new instance of ToolResponse.
8 |
# File 'lib/toolchest/rspec.rb', line 8 def initialize(raw) = @raw = raw |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/toolchest/rspec.rb', line 6 def raw @raw end |
Instance Method Details
#content ⇒ Object
14 |
# File 'lib/toolchest/rspec.rb', line 14 def content = @raw[:content] || [] |
#error? ⇒ Boolean
12 |
# File 'lib/toolchest/rspec.rb', line 12 def error? = @raw[:isError] == true |
#success? ⇒ Boolean
10 |
# File 'lib/toolchest/rspec.rb', line 10 def success? = !error? |
#suggests?(tool_name) ⇒ Boolean
18 |
# File 'lib/toolchest/rspec.rb', line 18 def suggests?(tool_name) = text.include?("Suggested next: call #{tool_name}") |
#text ⇒ Object
16 |
# File 'lib/toolchest/rspec.rb', line 16 def text = content.map { |c| c[:text] }.compact.join("\n") |