Class: Avm::Entries::Base::UriComponentsEntriesValues::ComponentFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/entries/base/uri_components_entries_values/component_factory.rb

Instance Method Summary collapse

Instance Method Details

#component_classObject



17
18
19
# File 'lib/avm/entries/base/uri_components_entries_values/component_factory.rb', line 17

def component_class
  specific_class || generic_class
end

#generic_classObject



21
22
23
# File 'lib/avm/entries/base/uri_components_entries_values/component_factory.rb', line 21

def generic_class
  parent_class.const_get('GenericComponent')
end

#parent_classObject



25
26
27
# File 'lib/avm/entries/base/uri_components_entries_values/component_factory.rb', line 25

def parent_class
  ::Avm::Entries::Base::UriComponentsEntriesValues
end

#resultObject



13
14
15
# File 'lib/avm/entries/base/uri_components_entries_values/component_factory.rb', line 13

def result
  component_class.new(owner, component)
end

#specific_classObject



29
30
31
32
33
# File 'lib/avm/entries/base/uri_components_entries_values/component_factory.rb', line 29

def specific_class
  return nil unless parent_class.const_defined?(specific_class_basename)

  parent_class.const_get(specific_class_basename)
end

#specific_class_basenameObject



35
36
37
# File 'lib/avm/entries/base/uri_components_entries_values/component_factory.rb', line 35

def specific_class_basename
  [component, 'component'].join('_').camelize
end