Sha256: 384845e9d756b54ff0e451f7d19d8c930958e4df9adb152e9fc736c3d2ddf5c0

Contents?: true

Size: 682 Bytes

Versions: 15

Compression:

Stored size: 682 Bytes

Contents

module WLang
  class Compiler
    class Filter < Temple::Filter

      module ClassMethods

        def recurse_on(*kinds)
          kinds.each do |kind|
            define_method(:"on_#{kind}") do |*args|
              recurse(kind, *args)
            end
          end
        end

      end
      extend ClassMethods

      module InstanceMethods

        def recurse(kind, *args)
          args.inject [kind] do |rw,arg|
            rw << (arg.is_a?(Array) ? call(arg) : arg)
          end
        end

      end
      include InstanceMethods

      recurse_on :template, :fn, :wlang, :strconcat, :modulo, :static
    end # class Filter
  end # class Compiler
end # module WLang

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wlang-3.0.1 lib/wlang/compiler/filter.rb
wlang-3.0.0 lib/wlang/compiler/filter.rb
wlang-2.3.1 lib/wlang/compiler/filter.rb
wlang-2.3.0 lib/wlang/compiler/filter.rb
wlang-2.2.4 lib/wlang/compiler/filter.rb
wlang-2.2.3 lib/wlang/compiler/filter.rb
wlang-2.2.2 lib/wlang/compiler/filter.rb
wlang-2.2.1 lib/wlang/compiler/filter.rb
wlang-2.2.0 lib/wlang/compiler/filter.rb
wlang-2.1.2 lib/wlang/compiler/filter.rb
wlang-2.1.1 lib/wlang/compiler/filter.rb
wlang-2.1.0 lib/wlang/compiler/filter.rb
wlang-2.0.1 lib/wlang/compiler/filter.rb
wlang-2.0.0 lib/wlang/compiler/filter.rb
wlang-2.0.0.beta lib/wlang/compiler/filter.rb