Class: EY::CloudClient::ResolverResult
- Inherits:
-
Object
- Object
- EY::CloudClient::ResolverResult
- Defined in:
- lib/engineyard-cloud-client/resolver_result.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
-
#suggestions ⇒ Object
readonly
Returns the value of attribute suggestions.
Instance Method Summary collapse
-
#initialize(api, matches, errors, suggestions) ⇒ ResolverResult
constructor
A new instance of ResolverResult.
- #many_matches(&block) ⇒ Object
- #many_matches? ⇒ Boolean
- #no_matches(&block) ⇒ Object
- #no_matches? ⇒ Boolean
- #one_match(&block) ⇒ Object
- #one_match? ⇒ Boolean
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
#api ⇒ Object (readonly)
Returns the value of attribute api.
4 5 6 |
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 4 def api @api end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 4 def errors @errors end |
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
4 5 6 |
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 4 def matches @matches end |
#suggestions ⇒ Object (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
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
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
10 |
# File 'lib/engineyard-cloud-client/resolver_result.rb', line 10 def one_match?() matches.size == 1 end |