Module: FormObject::Integrations

Defined in:
lib/form_object/integrations.rb,
lib/form_object/integrations/base.rb,
lib/form_object/integrations/active_model.rb,
lib/form_object/integrations/active_record.rb

Defined Under Namespace

Modules: ActiveModel, ActiveRecord, Base

Class Method Summary collapse

Class Method Details

.allObject

Get collection of all integrations ActiveModel must be last always

Example

Object::Integrations.all
# => [FormObject::Integrations::ActiveRecord]


23
24
25
26
27
28
# File 'lib/form_object/integrations.rb', line 23

def self.all
  constants = self.constants.map{ |c| c.to_s }
                            .select{ |c| c!= 'ActiveModel' }
                            .sort << 'ActiveModel'
  constants.map{ |c| const_get(c) }
end

.find(name) ⇒ Object

Find integration by name

Examples

FormObject::Integrations.find(:active_record) # => FormObject::Integrations::ActiveRecord


35
36
37
# File 'lib/form_object/integrations.rb', line 35

def self.find( name )
  all.detect {|i| i.integration_name == name} || raise(IntegrationNotFound.new(name))
end

.match(*args) ⇒ Object



39
40
41
# File 'lib/form_object/integrations.rb', line 39

def self.match( *args )
  all.detect {|i| i.matches_ancestors?(args)}
end