Class: Ezframe::KatakanaType
- Defined in:
- lib/ezframe/column_type.rb,
lib/ezframe/column_type.rb
Instance Attribute Summary
Attributes inherited from TypeBase
Instance Method Summary collapse
Methods inherited from TextType
Methods inherited from TypeBase
#db_type, #db_value, #form, get_class, #initialize, #key, #label, #make_error_box, #multi_inputs?, #no_edit?, #no_view?, #type, type_name, #use_view_format, #value, #value=, #view
Constructor Details
This class inherits a constructor from Ezframe::TypeBase
Instance Method Details
#normalize(val) ⇒ Object
647 648 649 650 |
# File 'lib/ezframe/column_type.rb', line 647 def normalize(val) val = super(val) return val.tr("ァ-ン", "ぁ-ん") end |
#validate(val) ⇒ Object
652 653 654 655 656 657 658 659 660 661 |
# File 'lib/ezframe/column_type.rb', line 652 def validate(val) super(val) return @error if @error return nil if !val || val.strip.empty? unless /^[ぁ-ん ]+$/ =~ val.to_s @error = :hiragana_only return @error end return nil end |