Sha256: e5c63e6ff255d57a0f4c2da5dbb4b50b8639046ff714313b0d5d07e4211674b2
Contents?: true
Size: 1.45 KB
Versions: 4
Compression:
Stored size: 1.45 KB
Contents
require 'wunderbar' source = Dir[File.expand_path('../polymer-*.min.js', __FILE__)]. sort_by {|name| name[/-v?([.\d]*)\.min.js$/,1].split('.').map(&:to_i)}.last Wunderbar::Asset.script :name => 'polymer-min.js', :file => source if self.to_s == 'main' class << self def _polymer_element(*args, &block) Wunderbar.polymer_element(*args, &block) end end module Wunderbar def self.polymer_element(*args, &block) callback = Proc.new do |scope, args, block| polymer_element(scope, *args, &block) end @queue << [callback, args, block] end class CGI def polymer_element(scope, *args, &block) headers = { 'type' => 'text/html', 'charset' => 'UTF-8' } x = HtmlMarkup.new(scope) begin element = x._polymer_element *args do x.instance_eval &block end output = element.serialize.join("\n") + "\n" rescue ::Exception => exception headers['status'] = "500 Internal Server Error" x.clear! output = x.html(*args) do _h1 'Internal Server Error' _exception exception end end out?(scope, headers) { output } end end end end module Wunderbar module SinatraHelpers def _polymer_element(*args, &block) Wunderbar::Template::Html.evaluate('_polymer_element', self) do _polymer_element(*args) { instance_eval &block } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
wunderbar-0.18.3 | lib/wunderbar/polymer.rb |
wunderbar-0.18.2 | lib/wunderbar/polymer.rb |
wunderbar-0.18.1 | lib/wunderbar/polymer.rb |
wunderbar-0.18.0 | lib/wunderbar/polymer.rb |