Module: Blender::Discovery
- Includes:
- Utils::Refinements
- Included in:
- SchedulerDSL, Task::Base
- Defined in:
- lib/blender/rspec.rb,
lib/blender/discovery.rb
Instance Method Summary collapse
- #build_discovery(type, opts = {}) ⇒ Object
- #old_search ⇒ Object
- #search(type, options = nil) ⇒ Object
- #search_with_config(type, opts = {}) ⇒ Object
Methods included from Utils::Refinements
Instance Method Details
#build_discovery(type, opts = {}) ⇒ Object
24 25 26 27 28 |
# File 'lib/blender/discovery.rb', line 24 def build_discovery(type, opts = {}) disco_klass = Blender::Discovery.const_get(camelcase(type.to_s).to_sym) disco_opts = blender_config(type).merge(opts) disco_klass.new(symbolize(disco_opts)) end |
#old_search ⇒ Object
30 |
# File 'lib/blender/rspec.rb', line 30 alias_method :old_search, :search |
#search(type, options = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/blender/rspec.rb', line 31 def search(type, = nil) stub = Blender::RSpec::StubRegistry.instance.data.detect do |st| st.type == type && st.opts == end if stub stub.return_value else old_search(type, ) end end |
#search_with_config(type, opts = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/blender/discovery.rb', line 30 def search_with_config(type, opts = {}) = opts.dup search_opts = .delete(:search) build_discovery(type, ).search(search_opts) end |