Module: RSchema::Coercers::Symbol

Extended by:
Symbol
Included in:
Symbol
Defined in:
lib/rschema/coercers/symbol.rb

Instance Method Summary collapse

Instance Method Details

#build(schema) ⇒ Object


7
8
9
# File 'lib/rschema/coercers/symbol.rb', line 7

def build(schema)
  self
end

#call(value) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/rschema/coercers/symbol.rb', line 11

def call(value)
  case value
  when ::Symbol then Result.success(value)
  when ::String then Result.success(value.to_sym)
  else Result.failure
  end
end