Sha256: ec1cd01613a799b367d1708b153c2c937893a8a1b4f4c1f38495f2b13ceb96c3
Contents?: true
Size: 417 Bytes
Versions: 15
Compression:
Stored size: 417 Bytes
Contents
require "myrrha/to_ruby_literal" class Foo attr_reader :arg def initialize(arg) @arg = arg end end MyRules = Myrrha::ToRubyLiteral.dup.append do |r| r.coercion(Foo) do |foo, _| "Foo.new(#{foo.arg.inspect})" end end # Myrrha.to_ruby_literal is actually a shortcut for: Myrrha::ToRubyLiteral.apply(Foo.new(:hello)) # => "Marshal.load('...')" MyRules.apply(Foo.new(:hello)) # => "Foo.new(:hello)"
Version data entries
15 entries across 15 versions & 1 rubygems