Class: Usher::Node::FailedResponse

Inherits:
Struct
  • Object
show all
Defined in:
lib/usher/node/failed_response.rb

Overview

The response from Root#lookup. Adds some convenience methods for common parameter manipulation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fail_sub_typeObject

Returns the value of attribute fail_sub_type

Returns:

  • (Object)

    the current value of fail_sub_type



4
5
6
# File 'lib/usher/node/failed_response.rb', line 4

def fail_sub_type
  @fail_sub_type
end

#fail_typeObject

Returns the value of attribute fail_type

Returns:

  • (Object)

    the current value of fail_type



4
5
6
# File 'lib/usher/node/failed_response.rb', line 4

def fail_type
  @fail_type
end

#last_matching_nodeObject

Returns the value of attribute last_matching_node

Returns:

  • (Object)

    the current value of last_matching_node



4
5
6
# File 'lib/usher/node/failed_response.rb', line 4

def last_matching_node
  @last_matching_node
end

Instance Method Details

#acceptable_responsesObject



19
20
21
22
23
24
25
26
# File 'lib/usher/node/failed_response.rb', line 19

def acceptable_responses
  case fail_type
  when :request_method
    last_matching_node.request.keys
  when :normal_or_greedy
    (last_matching_node.greedy || []) + (last_matching_node.normal || [])
  end
end

#acceptable_responses_only_stringsObject



28
29
30
# File 'lib/usher/node/failed_response.rb', line 28

def acceptable_responses_only_strings
  acceptable_responses.select{|r| r.is_a?(String)}
end

#normal_or_greedy?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/usher/node/failed_response.rb', line 15

def normal_or_greedy?
  fail_type == :normal_or_greedy
end

#request_method?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/usher/node/failed_response.rb', line 11

def request_method?
  fail_type == :request_method
end

#succeeded?Boolean

The success of the response

Returns:

  • (Boolean)

    Always returns false



7
8
9
# File 'lib/usher/node/failed_response.rb', line 7

def succeeded?
  false
end