Sha256: b731fab9fb68560b24854c4ee03c8be5e8c5b0606bccc42e61e213cbfe999112
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 Bytes
Contents
require_relative "identity_processor" module PageEz module MethodGenerators class DefineHasOneResultMethods def initialize(name, evaluator_class:, constructor:, processor: IdentityProcessor) @name = name @evaluator_class = evaluator_class @processor = processor @constructor = constructor end def run(target) evaluator_class = @evaluator_class processor = @processor constructor = @constructor target.logged_define_method(@name) do |*args| evaluator = evaluator_class.run(processor.run_args(args), target: self) selector = processor.selector(evaluator.selector, args) PageEz.reraise_selector_error(selector) do PageEz::HasOneResult.new( container: container, selector: selector, options: evaluator.options, constructor: constructor.method(:new) ) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
page_ez-0.2.0 | lib/page_ez/method_generators/define_has_one_result_methods.rb |
page_ez-0.1.0 | lib/page_ez/method_generators/define_has_one_result_methods.rb |