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, #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
611 612 613 614 |
# File 'lib/ezframe/column_type.rb', line 611 def normalize(val) val = super(val) return val.tr("ァ-ン", "ぁ-ん") end |
#validate(val) ⇒ Object
616 617 618 619 620 621 622 623 624 625 |
# File 'lib/ezframe/column_type.rb', line 616 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 |