Module: RSchema::Coercers::Symbol
Overview
Coerces ‘String`s to `Symbol`s
Instance Method Summary collapse
Instance Method Details
#build(_schema) ⇒ Object
11 12 13 |
# File 'lib/rschema/coercers/symbol.rb', line 11 def build(_schema) self end |
#call(value) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rschema/coercers/symbol.rb', line 15 def call(value) case value when ::Symbol then Result.success(value) when ::String then Result.success(value.to_sym) else Result.failure end end |
#will_affect?(value) ⇒ Boolean
23 24 25 |
# File 'lib/rschema/coercers/symbol.rb', line 23 def will_affect?(value) !value.is_a?(Symbol) end |