Class: AlTime
- Inherits:
-
AlTimestamp
- Object
- AlWidget
- AlTimestamp
- AlTime
- Defined in:
- lib/al_form.rb
Overview
Note:
時刻ウィジェット
時分秒を扱う 内部的には日付を2000年に固定したTimeオブジェクトで保存する。
Constant Summary collapse
- STRFTIME_FORMAT =
"%H:%M:%S"
Instance Attribute Summary
Attributes inherited from AlTimestamp
Attributes inherited from AlWidget
#filter, #foreign, #hidden, #label, #message, #name, #required, #tag_attr, #tag_type, #value
Instance Method Summary collapse
-
#initialize(name, arg = {}) ⇒ AlTime
constructor
(AlTime) constructor.
-
#make_value(*arg) ⇒ String
(AlTime) HTML値の生成.
Methods inherited from AlTimestamp
Methods inherited from AlWidget
#make_tag, #set_attr, #set_value
Constructor Details
#initialize(name, arg = {}) ⇒ AlTime
(AlTime) constructor
1679 1680 1681 1682 |
# File 'lib/al_form.rb', line 1679 def initialize( name, arg = {} ) super( name, arg ) @value = normalize( @value ) if @value.class == Time end |
Instance Method Details
#make_value(*arg) ⇒ String
(AlTime) HTML値の生成
1691 1692 1693 1694 1695 1696 1697 1698 |
# File 'lib/al_form.rb', line 1691 def make_value( *arg ) v = arg.empty? ? @value : arg[0] if v.class == Time return v.strftime('%H:%M:%S') else return Alone::escape_html( v ) end end |