Class: Formation::Type
- Inherits:
-
Object
- Object
- Formation::Type
- Defined in:
- lib/formation/type.rb
Class Method Summary collapse
Class Method Details
.create(field, type) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/formation/type.rb', line 3 def self.create(field, type) klass = case type.to_sym when :checkbox Formation::Types::Checkbox when :password Formation::Types::Password when :text Formation::Types::Text when :textarea Formation::Types::TextArea else raise "Invalid or unsupported field type: #{type}" end klass.new(field) end |