class Xembly::Strict

STRICT directive

Public Class Methods

new(count) click to toggle source

Ctor.

count

How many nodes to expect

# File lib/xembly/strict.rb, line 31
def initialize(count)
  @count = count.to_i
end

Public Instance Methods

exec(_, cursor) click to toggle source
# File lib/xembly/strict.rb, line 35
def exec(_, cursor)
  raise "there are #{cursor.length} nodes, while #{@count} expected" unless \
    cursor.length == @count

  cursor
end