Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
口からテンプレートがどんどん出てくる
# coding:utf-8
def render(template, variables = {})
template.gsub(/✖╹ *(.+?) *╹✖/) do
$1.split('.').inject(variables) do |hash, key|
hash[key.to_sym] or break nil
end
end
end
puts render(
'✖╹ yunotti.mouth ╹✖',
yunotti: { mouth: "口からテンプレートがどんどん出てくる" }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.