Class: YuiRestClient::Widgets::Datefield
- Defined in:
- lib/yui_rest_client/widgets/datefield.rb
Overview
Class representing a date field in the UI, namely YDateField.
Instance Method Summary collapse
-
#set(date) ⇒ Datefield
Sends action to set the value of date field.
-
#value ⇒ String
Returns text that is currently set for datefield.
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(date) ⇒ Datefield
Sends action to set the value of date field. Accepts Date, Time or DateTime object and sets value in ISO 8601 format YYYY-MM-DD.
18 19 20 21 22 23 24 25 |
# File 'lib/yui_rest_client/widgets/datefield.rb', line 18 def set(date) unless [Date, DateTime, Time].any? { |c| date.is_a? c } raise Error::YuiRestClientError, 'Parameter is not Date, Time or DateTime' end action(action: Actions::ENTER_TEXT, value: date.strftime('%F')) self end |
#value ⇒ String
Returns text that is currently set for datefield. Gets value from ‘value’ parameter in JSON representation of YDateField.
42 43 44 |
# File 'lib/yui_rest_client/widgets/datefield.rb', line 42 def value property(:value) end |