Module: Formotion::RowType

Defined in:
lib/formotion/row_type/base.rb,
lib/formotion/row_type/button.rb,
lib/formotion/row_type/map_row.rb,
lib/formotion/row_type/back_row.rb,
lib/formotion/row_type/date_row.rb,
lib/formotion/row_type/edit_row.rb,
lib/formotion/row_type/row_type.rb,
lib/formotion/row_type/tags_row.rb,
lib/formotion/row_type/text_row.rb,
lib/formotion/row_type/check_row.rb,
lib/formotion/row_type/email_row.rb,
lib/formotion/row_type/image_row.rb,
lib/formotion/row_type/phone_row.rb,
lib/formotion/row_type/number_row.rb,
lib/formotion/row_type/object_row.rb,
lib/formotion/row_type/picker_row.rb,
lib/formotion/row_type/slider_row.rb,
lib/formotion/row_type/static_row.rb,
lib/formotion/row_type/string_row.rb,
lib/formotion/row_type/submit_row.rb,
lib/formotion/row_type/switch_row.rb,
lib/formotion/row_type/options_row.rb,
lib/formotion/row_type/subform_row.rb,
lib/formotion/row_type/currency_row.rb,
lib/formotion/row_type/items_mapper.rb,
lib/formotion/row_type/template_row.rb,
lib/formotion/row_type/web_link_row.rb,
lib/formotion/row_type/web_view_row.rb,
lib/formotion/row_type/paged_image_row.rb,
lib/formotion/row_type/multi_choice_row.rb,
lib/formotion/row_type/activity_view_row.rb

Defined Under Namespace

Modules: ItemsMapper, MultiChoiceRow Classes: ActivityRow, BackRow, Base, ButtonRow, CheckRow, CurrencyRow, DateRow, EditRow, EmailRow, ImageRow, MapRow, MapRowData, NumberRow, ObjectRow, OptionsRow, PagedImageRow, PhoneRow, PickerRow, SliderRow, StaticRow, StringRow, SubformRow, SubmitRow, SwitchRow, TagsRow, TemplateRow, TextRow, WebLinkRow, WebViewRow

Constant Summary collapse

ROW_TYPES =
Formotion::RowType.constants(false).select { |constant_name| constant_name =~ /Row$/ }

Class Method Summary collapse

Class Method Details

.for(string_or_sym) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/formotion/row_type/row_type.rb', line 6

def for(string_or_sym)
  type = string_or_sym

  if type.is_a?(Symbol) or type.is_a? String
    string = "#{type.to_s.downcase}_row".camelize
    if not const_defined? string
      raise Formotion::InvalidClassError, "Invalid RowType value #{string_or_sym}. Create a class called #{string}"
    end
    Formotion::RowType.const_get(string)
  else
    raise Formotion::InvalidClassError, "Attempted row type #{type.inspect} is not a valid RowType."
  end
end