class Botz::Binder::Multiple
binding multiple
Public Class Methods
bind(connector:, binder:, query:, block:)
click to toggle source
# File lib/botz/binder.rb, line 11 def self.bind(connector:, binder:, query:, block:) multiple_binding_class = self connector.field.call(binder, query) do |elements| multiple_binding_class.new(binder.class).instance_exec(elements, &block) end end
new(binder)
click to toggle source
# File lib/botz/binder.rb, line 18 def initialize(binder) @binder = binder end
Public Instance Methods
field(name) { || ... }
click to toggle source
# File lib/botz/binder.rb, line 22 def field(name) @binder.field_names << name @binder.field_names.uniq! @binder.result_class.define(name) result = yield @binder.define_method(name) { result } end