Sha256: 63921479be4479b04766b576f607ff8406b64e484b377c989455389b7ff40299
Contents?: true
Size: 636 Bytes
Versions: 5
Compression:
Stored size: 636 Bytes
Contents
module Avo module Loaders class FieldsLoader < Loader def add_field(field) @bag.push field end def method_missing(method, *args, &block) matched_field = Avo::App.fields.find do |field| field[:name].to_s == method.to_s end if matched_field.present? and matched_field[:class].present? klass = matched_field[:class] if block.present? field = klass.new(args[0], **args[1] || {}, &block) else field = klass.new(args[0], **args[1] || {}) end add_field field end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems