Class: T12n::Serializer
- Inherits:
-
Object
- Object
- T12n::Serializer
- Defined in:
- lib/t12n/serializer.rb
Class Method Summary collapse
Class Method Details
.from_proc(prc) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/t12n/serializer.rb', line 6 def from_proc(prc) case prc.arity when 0 ->(_object) { prc.() } when 1, -1, -2 ->(object) { prc.(object) } else raise T12n::ArgumentError, "Unexpected proc arity: #{prc.arity}" end end |