Sha256: 3f4e10610f3de28b965ae2f6bd4b6abb22fd71541f7aa8915c0ed2b86af82f25

Contents?: true

Size: 246 Bytes

Versions: 15

Compression:

Stored size: 246 Bytes

Contents

require 'myrrha/coerce'

class Foo
  def initialize(arg)
    @arg = arg
  end
end

Myrrha::Coerce.append do |r|
  r.coercion(Symbol, Foo) do |value, _|
    Foo.new(value)
  end
end 

Myrrha.coerce(:hello, Foo) 
# => #<Foo:0x8866f84 @arg=:hello>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
myrrha-3.1.0 examples/coerce_foo2.rb
myrrha-3.0.0 examples/coerce_foo2.rb
myrrha-3.0.0.rc7 examples/coerce_foo2.rb
myrrha-3.0.0.rc6 examples/coerce_foo2.rb
myrrha-3.0.0.rc5 examples/coerce_foo2.rb
myrrha-3.0.0.rc4 examples/coerce_foo2.rb
myrrha-3.0.0.rc3 examples/coerce_foo2.rb
myrrha-3.0.0.rc2 examples/coerce_foo2.rb
myrrha-3.0.0.rc1 examples/coerce_foo2.rb
myrrha-2.0.0 examples/coerce_foo2.rb
myrrha-1.2.2 examples/coerce_foo2.rb
myrrha-1.2.1 examples/coerce_foo2.rb
myrrha-1.2.0 examples/coerce_foo2.rb
myrrha-1.1.0 examples/coerce_foo2.rb
myrrha-1.0.0 examples/coerce_foo2.rb