Module: Scjson::Types::AssignTypeDatatypeProps
- Defined in:
- lib/scjson/types.rb
Overview
The assign type that allows for precise manipulation of the datamodel location. Types are: replacechildren (default), firstchild, lastchild, previoussibling, nextsibling, replace, delete, addattribute
Constant Summary collapse
- REPLACECHILDREN =
'replacechildren'.freeze
- FIRSTCHILD =
'firstchild'.freeze
- LASTCHILD =
'lastchild'.freeze
- PREVIOUSSIBLING =
'previoussibling'.freeze
- NEXTSIBLING =
'nextsibling'.freeze
- REPLACE =
'replace'.freeze
- DELETE =
'delete'.freeze
- ADDATTRIBUTE =
'addattribute'.freeze
- DEFAULT =
REPLACECHILDREN- VALUES =
[REPLACECHILDREN, FIRSTCHILD, LASTCHILD, PREVIOUSSIBLING, NEXTSIBLING, REPLACE, DELETE, ADDATTRIBUTE].freeze
Class Method Summary collapse
-
.coerce(value, allow_nil: false) ⇒ String?
Coerce arbitrary input into a valid enumeration value.
-
.default ⇒ String
Schema-defined default enumeration value.
-
.values ⇒ Array<String>
All legal enumeration values.
Class Method Details
.coerce(value, allow_nil: false) ⇒ String?
Coerce arbitrary input into a valid enumeration value.
43 44 45 46 47 48 49 50 51 |
# File 'lib/scjson/types.rb', line 43 def coerce(value, allow_nil: false) return nil if allow_nil && value.nil? return DEFAULT if value.nil? candidate = value.to_s return candidate if VALUES.include?(candidate) raise ArgumentError, "Unsupported value '#{value}' for AssignTypeDatatypeProps" end |
.default ⇒ String
Returns Schema-defined default enumeration value.
35 36 37 |
# File 'lib/scjson/types.rb', line 35 def default DEFAULT end |
.values ⇒ Array<String>
Returns All legal enumeration values.
30 31 32 |
# File 'lib/scjson/types.rb', line 30 def values VALUES end |