lib/assetify/dsl.rb in assetify-0.1.1 vs lib/assetify/dsl.rb in assetify-0.2.1
- old
+ new
@@ -2,12 +2,14 @@
class DSL
def pkg name, url, &block
@pkg = Pkg.new name, url
+ @ns = name
instance_exec(&block)
- @pkg = nil
+ @ns = nil
+ assets
end
def group name, &block
@ns = name
instance_exec(&block)
@@ -17,11 +19,15 @@
def assets
@assets
end
- def method_missing method, name, uri, ver=nil, params={}
- (@assets ||= []) << Asset.new(method.to_sym, name, uri, ver, params.merge({ :ns => @ns, :pkg => @pkg}))
+ def method_missing method, name, uri, *params
+ params, ver = params.partition { |param| param.is_a?(Hash) }
+ opts = {:ns => @ns, :pkg => @pkg}
+ params.each { |hsh| opts.merge! hsh }
+ ver = ver[0]
+ (@assets ||= []) << Asset.new(method.to_sym, name, uri, ver, opts)
end
class << self
def parse io