Class: Pangea::Magma::Matchers::CompatibleWithBackend
- Defined in:
- lib/pangea/magma/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(backend) ⇒ CompatibleWithBackend
constructor
A new instance of CompatibleWithBackend.
- #matches?(_workspace_path_or_nil = nil) ⇒ Boolean
- #requiring_feature(feature) ⇒ Object
- #requiring_input_format(format) ⇒ Object
Constructor Details
#initialize(backend) ⇒ CompatibleWithBackend
Returns a new instance of CompatibleWithBackend.
124 125 126 127 |
# File 'lib/pangea/magma/matchers.rb', line 124 def initialize(backend) @backend = backend @requires = {} end |
Instance Method Details
#description ⇒ Object
156 157 158 |
# File 'lib/pangea/magma/matchers.rb', line 156 def description "be compatible with backend #{@backend.inspect}" end |
#failure_message ⇒ Object
152 153 154 |
# File 'lib/pangea/magma/matchers.rb', line 152 def @failure_message || "expected backend #{@backend} to be compatible with requires=#{@requires.inspect}" end |
#matches?(_workspace_path_or_nil = nil) ⇒ Boolean
141 142 143 144 145 146 147 148 149 150 |
# File 'lib/pangea/magma/matchers.rb', line 141 def matches?(_workspace_path_or_nil = nil) Pangea::Backend.verify_compatible!(@backend, @requires) true rescue Pangea::Backend::BackendIncompatible => e @failure_message = e. false rescue Pangea::Backend::BackendUnavailable => e @failure_message = "backend #{@backend} unavailable: #{e.}" false end |
#requiring_feature(feature) ⇒ Object
130 131 132 133 |
# File 'lib/pangea/magma/matchers.rb', line 130 def requiring_feature(feature) @requires[:feature] = feature self end |
#requiring_input_format(format) ⇒ Object
136 137 138 139 |
# File 'lib/pangea/magma/matchers.rb', line 136 def requiring_input_format(format) @requires[:input_format] = format self end |