Class: Toolchest::RSpec::ToolResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/toolchest/rspec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#rawObject (readonly)

Returns the value of attribute raw.



6
7
8
# File 'lib/toolchest/rspec.rb', line 6

def raw
  @raw
end

Instance Method Details

#contentObject



14
# File 'lib/toolchest/rspec.rb', line 14

def content = @raw[:content] || []

#error?Boolean

Returns:

  • (Boolean)


12
# File 'lib/toolchest/rspec.rb', line 12

def error? = @raw[:isError] == true

#success?Boolean

Returns:

  • (Boolean)


10
# File 'lib/toolchest/rspec.rb', line 10

def success? = !error?

#suggests?(tool_name) ⇒ Boolean

Returns:

  • (Boolean)


18
# File 'lib/toolchest/rspec.rb', line 18

def suggests?(tool_name) = text.include?("Suggested next: call #{tool_name}")

#textObject



16
# File 'lib/toolchest/rspec.rb', line 16

def text = content.map { |c| c[:text] }.compact.join("\n")