Class: Jsapi::JSON::String
Overview
Represents a JSON string.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Value
Instance Method Summary collapse
-
#empty? ⇒ Boolean
See Value#empty?.
-
#initialize(value, schema) ⇒ String
constructor
A new instance of String.
Methods inherited from Value
Constructor Details
#initialize(value, schema) ⇒ String
Returns a new instance of String.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jsapi/json/string.rb', line 9 def initialize(value, schema) super(schema) @value = schema.convert( case schema.format when 'date' value.to_date when 'date-time' value.to_datetime else value.to_s end ) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/jsapi/json/string.rb', line 7 def value @value end |
Instance Method Details
#empty? ⇒ Boolean
See Value#empty?.
24 25 26 |
# File 'lib/jsapi/json/string.rb', line 24 def empty? value.blank? end |