Skip to content

Commit

Permalink
Mustache#render is now the main method. #to_html is just an alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Oct 7, 2009
1 parent c016085 commit f87d8af
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/mustache.rb
Expand Up @@ -205,15 +205,10 @@ def []=(key, value)
context[key.to_sym] = value
end

# How we turn a view object into HTML. The main method, if you will.
def to_html
render template
end

# Parses our fancy pants template HTML and returns normal HTML with
# all special {{tags}} and {{#sections}}replaced{{/sections}}.
def render(html, ctx = {})
html = self.class.templateify(html)
html.render(context.update(ctx))
def render
self.class.templateify(template).render(context)
end
alias_method :to_html, :render
end

0 comments on commit f87d8af

Please sign in to comment.