class Avo::Fields::FieldManager
def all
def all fields .map do |field| field[:name] = field[:name].to_s field end .uniq do |field| field[:name] end end
def build
def build instance = new instance.init_fields instance end
def init_fields
Avo::Fields::TextField -> text
If the field has their `def_method` set up it will follow that convention, if not it will snake_case the name:
so later we can instantiate them on our resources.
This method will find all fields available in the Avo::Fields namespace and add them to the fields class_variable array
def init_fields Avo::Fields::BaseField.descendants.each do |class_name| next if class_name.to_s == "BaseField" if class_name.to_s.end_with? "Field" load_field class_name.get_field_name, class_name end end end
def initialize
def initialize @fields = [] end
def load_field(method_name, klass)
def load_field(method_name, klass) fields.push( name: method_name.to_s, class: klass ) end