Module: Scjson::Types::TransitionTypeDatatypeProps
- Defined in:
- lib/scjson/types.rb
Overview
The type of the transition i.e. internal or external.
Constant Summary collapse
- INTERNAL =
'internal'.freeze
- EXTERNAL =
'external'.freeze
- DEFAULT =
INTERNAL- VALUES =
[INTERNAL, EXTERNAL].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.
213 214 215 216 217 218 219 220 221 |
# File 'lib/scjson/types.rb', line 213 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 TransitionTypeDatatypeProps" end |
.default ⇒ String
Returns Schema-defined default enumeration value.
205 206 207 |
# File 'lib/scjson/types.rb', line 205 def default DEFAULT end |
.values ⇒ Array<String>
Returns All legal enumeration values.
200 201 202 |
# File 'lib/scjson/types.rb', line 200 def values VALUES end |