Sha256: 1c6b8d33964befef5043756471c2b14a99a1b0383a56fde8a5ea4a07319c1bde

Contents?: true

Size: 732 Bytes

Versions: 2

Compression:

Stored size: 732 Bytes

Contents

module Assetify

  class DSL

    def pkg name, url, &block
      @pkg = Pkg.new name, url
      @ns = name
      instance_exec(&block)
      @ns = nil
      assets
    end

    def group name, &block
      @ns = name
      instance_exec(&block)
      @ns = nil
      assets
    end

    def assets
      @assets
    end

    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
        new.instance_eval(io) #.assets
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
assetify-0.2.2 lib/assetify/dsl.rb
assetify-0.2.1 lib/assetify/dsl.rb