Class: YuiRestClient::Widgets::Timefield
- Defined in:
- lib/yui_rest_client/widgets/timefield.rb
Overview
Class representing a DateField in the UI, namely YTimeField.
Instance Method Summary collapse
-
#set(time) ⇒ Timefield
Sends action to set the value of time field.
-
#value ⇒ String
Returns text that is currently set for timefield.
Methods inherited from Base
#action, #collect_all, #debug_label, #enabled?, #exists?, #initialize, #property
Methods included from YuiRestClient::Waitable
Constructor Details
This class inherits a constructor from YuiRestClient::Widgets::Base
Instance Method Details
#set(time) ⇒ Timefield
Sends action to set the value of time field. Accepts Time or DateTime object and sets value in ISO 8601 format HH:MM:SS.
16 17 18 19 20 21 22 23 |
# File 'lib/yui_rest_client/widgets/timefield.rb', line 16 def set(time) unless [DateTime, Time].any? { |c| time.is_a? c } raise Error::YuiRestClientError, 'Parameter is not Date, Time or DateTime' end action(action: Actions::ENTER_TEXT, value: time.strftime('%T')) self end |
#value ⇒ String
Returns text that is currently set for timefield. Gets value from ‘value’ parameter in JSON representation of YTimeField.
40 41 42 |
# File 'lib/yui_rest_client/widgets/timefield.rb', line 40 def value property(:value) end |