Module: Beaker::DSL::Patterns
- Included in:
- Beaker::DSL, Host, HostPrebuiltSteps
- Defined in:
- lib/beaker/dsl/patterns.rb
Overview
These are simple patterns that appear frequently in beaker test code, and are provided to simplify test construction.
It requires the class it is mixed into to provide the attribute ‘hosts` which contain the hosts to search, these should implement Host’s interface. They, at least, must have #[] and #to_s available and provide an array when #[](‘roles’) is called.
Instance Method Summary collapse
-
#block_on(hosts_or_filter, opts = {}, &block) ⇒ Array<Result>, ...
Execute a block selecting the hosts that match with the provided criteria.
Instance Method Details
#block_on(hosts_or_filter, opts = {}, &block) ⇒ Array<Result>, ...
Execute a block selecting the hosts that match with the provided criteria
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/beaker/dsl/patterns.rb', line 25 def block_on hosts_or_filter, opts = {}, &block block_hosts = nil if defined? hosts block_hosts = hosts end filter = nil if hosts_or_filter.is_a? String or hosts_or_filter.is_a? Symbol filter = hosts_or_filter else block_hosts = hosts_or_filter end run_block_on block_hosts, filter, opts, &block end |