Class: Jirarest2Field::DateField
Overview
A simple Date field.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Field
#allowed_values, #id, #name, #raw_value, #readonly, #required
Instance Method Summary collapse
-
#parse_value(jvalue) ⇒ Object
Parse the value of this field as sent by the server.
-
#to_j(value = @value) ⇒ Hash
Representation to be used for json and jira.
-
#to_j_inner ⇒ Hash
Representation to be used for json and jira without the fieldId.
-
#value(raw = false) ⇒ String, Date
Get the value.
-
#value=(content) ⇒ Object
Set the value.
Methods inherited from Field
#createmeta, #initialize, #value_allowed?
Constructor Details
This class inherits a constructor from Jirarest2Field::Field
Instance Method Details
#parse_value(jvalue) ⇒ Object
Parse the value of this field as sent by the server
197 198 199 200 |
# File 'lib/jirarest2/field.rb', line 197 def parse_value(jvalue) super @value = Date.parse(jvalue) end |
#to_j(value = @value) ⇒ Hash
Representation to be used for json and jira
187 188 189 190 191 192 193 |
# File 'lib/jirarest2/field.rb', line 187 def to_j(value = @value) if value.nil? then super(nil) else super(value.to_s) end end |
#to_j_inner ⇒ Hash
Representation to be used for json and jira without the fieldId
204 205 206 207 208 209 210 |
# File 'lib/jirarest2/field.rb', line 204 def to_j_inner if @value.nil? then super(nil) else super(@value.to_s) end end |
#value(raw = false) ⇒ String, Date
Get the value
177 178 179 180 181 182 183 |
# File 'lib/jirarest2/field.rb', line 177 def value(raw = false) if raw then super else return @value.to_s end end |
#value=(content) ⇒ Object
Set the value
168 169 170 171 |
# File 'lib/jirarest2/field.rb', line 168 def value=(content) value = Date.parse(content) @value = value if value_allowed?(value) end |