Sha256: da1ad6f2c132d999cf6424c3aa053ffc39af04883da2f12adabecf9fd663f1e8
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
module PageEz module MethodGenerators class DefineHasOnePredicateMethods def initialize(name, evaluator_class:, processor: IdentityProcessor) @name = name @evaluator_class = evaluator_class @processor = processor end def run(target) evaluator_class = @evaluator_class processor = @processor target.logged_define_method("has_#{@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 has_css?( selector, **evaluator.options ) end end target.logged_define_method("has_no_#{@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 has_no_css?( selector, **evaluator.options ) 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_predicate_methods.rb |
page_ez-0.1.0 | lib/page_ez/method_generators/define_has_one_predicate_methods.rb |