Sha256: a2707aeb8fbeb3992a7f5b09144d0e676d3f2b23e72863a44211fdd41230e302
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
module PageEz module MethodGenerators class HasManyStaticSelector attr_reader :selector def initialize(name, selector, dynamic_options, options, &block) @name = name @selector = selector @block = block @evaluator_class = SelectorEvaluator.build(name, dynamic_options: dynamic_options, options: options, selector: selector) end def run(target) target.constructor_from_block(&@block).tap do |constructor| DefineHasManyResultMethods.new( @name, evaluator_class: @evaluator_class, constructor: constructor ).run(target) singularized_name = Pluralization.new(@name).singularize DefineHasOneResultMethods.new( "#{singularized_name}_matching", evaluator_class: @evaluator_class, constructor: constructor ).run(target) DefineHasOnePredicateMethods.new( "#{singularized_name}_matching", evaluator_class: @evaluator_class ).run(target) end end def selector_type :static 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/has_many_static_selector.rb |
page_ez-0.1.0 | lib/page_ez/method_generators/has_many_static_selector.rb |