Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 18 lines (14 sloc) 0.286 kb
37bb1d4e »
2011-07-22 How to extend default behavior?
1 require "myrrha/to_ruby_literal"
2
3 class Foo
4 attr_reader :arg
5 def initialize(arg)
6 @arg = arg
7 end
8 end
9
4e836e7d »
2011-07-22 ToRubyLiteralRules -> ToRubyLiteral, coerce -> apply
10 Myrrha::ToRubyLiteral.append do |r|
b79e6967 »
2011-07-22 Implemented main_target_domain
11 r.coercion(Foo) do |foo, _|
37bb1d4e »
2011-07-22 How to extend default behavior?
12 "Foo.new(#{foo.arg.inspect})"
13 end
14 end
15
16 Myrrha.to_ruby_literal(Foo.new(:hello))
17 # => "Foo.new(:hello)"
Something went wrong with that request. Please try again.