Skip to content

Instantly share code, notes, and snippets.

@mururu
Last active December 24, 2015 16:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mururu/6827370 to your computer and use it in GitHub Desktop.
Save mururu/6827370 to your computer and use it in GitHub Desktop.
sigil for erlang-mruby
iex(1)> import SigilMruby
nil
iex(2)> %m( [1,2,3].map do |i|         
...(2)>   i + 1                        
...(2)> end) |> Enum.each(&IO.inspect/1)
2
3
4
:ok
iex(3)> %m| %w{ a b c }.join ||> IO.puts
abc
:ok
defmodule SigilMruby do
defmacro sigil_m({ :<<>>, _line, [string] }, []) when is_binary(string) do
:mruby.eval(string)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment