Sha256: 106eb74bb53057f86e43b0c4c93a7a923403f51286c5c98fe0e7497267ece1f3
Contents?: true
Size: 563 Bytes
Versions: 17
Compression:
Stored size: 563 Bytes
Contents
# Renders various formats of code for a given piece of Ruby API code. module Haml::Filters::Example include Haml::Filters::Base def render(text) # TODO move this into a klass so that different formats are supported 'n' such formats = {} formats[:ruby] = text eval(text, self.send(:binding)) # Run the ruby code so we can get at the curl formats, etc formats[:curl] = PollEverywhere.config.http_adapter.last_requests.map(&:to_curl).join("\n\n") formats.map{ |format, example| %(<pre class="#{format}">#{example}</pre>) }.join end end
Version data entries
17 entries across 17 versions & 1 rubygems