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, #form_html, get_class, #initialize, #key, #label, #multi_inputs?, #no_edit?, #no_view?, type_name, #value, #value=, #view
Constructor Details
This class inherits a constructor from Ezframe::TypeBase
Instance Method Details
#normalize(val) ⇒ Object
437 438 439 440 |
# File 'lib/ezframe/column_type.rb', line 437 def normalize(val) val = super(val) return val.tr("ァ-ン", "ぁ-ん") end |
#validate(val) ⇒ Object
442 443 444 445 446 447 448 449 450 |
# File 'lib/ezframe/column_type.rb', line 442 def validate(val) super(val) return @error if @error unless /^[ぁ-ん ]+$/ =~ val.to_s @error = :hiragana_only return @error end return nil end |