regexp.rb 660 B

123456789101112131415161718192021222324252627
  1. # this require is required (hehe) because of Rails autoloading
  2. # which causes strange behavior not inheriting correctly
  3. # from Import::OTRS::DynamicField
  4. require_dependency 'import/zendesk/object_attribute/base'
  5. module Import
  6. class Zendesk
  7. module ObjectAttribute
  8. class Regexp < Import::Zendesk::ObjectAttribute::Base
  9. def init_callback(object_attribte)
  10. @data_option.merge!(
  11. type: 'text',
  12. maxlength: 255,
  13. regex: object_attribte.regexp_for_validation,
  14. )
  15. end
  16. private
  17. def data_type(_attribute)
  18. 'input'
  19. end
  20. end
  21. end
  22. end
  23. end