Class: EY::CloudClient::ResolverResult

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-cloud-client/resolver_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api, matches, errors, suggestions) ⇒ ResolverResult

Returns a new instance of ResolverResult.



6
7
8
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 6

def initialize(api, matches, errors, suggestions)
  @api, @matches, @errors, @suggestions = api, matches, errors, suggestions
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



4
5
6
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 4

def api
  @api
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 4

def errors
  @errors
end

#matchesObject (readonly)

Returns the value of attribute matches.



4
5
6
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 4

def matches
  @matches
end

#suggestionsObject (readonly)

Returns the value of attribute suggestions.



4
5
6
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 4

def suggestions
  @suggestions
end

Instance Method Details

#many_matches(&block) ⇒ Object



16
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 16

def many_matches(&block) many_matches? && block && block.call(matches)             end

#many_matches?Boolean

Returns:

  • (Boolean)


12
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 12

def many_matches?() matches.size > 1  end

#no_matches(&block) ⇒ Object



15
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 15

def no_matches(&block)   no_matches?   && block && block.call(errors, suggestions) end

#no_matches?Boolean

Returns:

  • (Boolean)


11
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 11

def no_matches?()   matches.empty?    end

#one_match(&block) ⇒ Object



14
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 14

def one_match(&block)    one_match?    && block && block.call(matches.first)       end

#one_match?Boolean

Returns:

  • (Boolean)


10
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 10

def one_match?()    matches.size == 1 end