File: filter.rb

package info (click to toggle)
ruby-temple 0.10.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 476 kB
  • sloc: ruby: 3,347; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true
module Temple
  module HTML
    # @api public
    class Filter < Temple::Filter
      include Dispatcher

      def contains_nonempty_static?(exp)
        case exp.first
        when :multi
          exp[1..-1].any? {|e| contains_nonempty_static?(e) }
        when :escape
          contains_nonempty_static?(exp.last)
        when :static
          !exp.last.empty?
        else
          false
        end
      end
    end
  end
end