Sha256: 02b0bc32b42fce50ba7052b0a61902f6611c1cd557a6eb5f76fb86b52e1f6783
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require 'yaml' module Precious module Views module SprocketsHelpers def self.included(base) def helper_proc_with_options(method) Proc.new do |args| args = args.split(' ') if args.size > 1 then options = args[1..-1].join(' ') options = YAML.safe_load("---\n#{options}\n", [Symbol]) end options = options.respond_to?(:to_h) ? options.to_h : {} options = options.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} send(method, args[0], options) end end ['stylesheet_path','javascript_path', 'image_path'].each do |method| define_method :"#{method}_mustache" do Proc.new {|args| send(method.to_sym, args)} end end ['stylesheet_tag','javascript_tag'].each do |method| define_method :"#{method}_mustache" do helper_proc_with_options(method.to_sym) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
inc_gollum-5.0.1b.pre.rc2 | lib/gollum/views/helpers.rb |
inc_gollum-5.0.1b.pre.rc1 | lib/gollum/views/helpers.rb |