Class: Xembly::Strict
- Inherits:
-
Object
- Object
- Xembly::Strict
- Defined in:
- lib/xembly/strict.rb
Overview
STRICT directive
Instance Method Summary collapse
- #exec(_, cursor) ⇒ Object
-
#initialize(count) ⇒ Strict
constructor
Ctor.
Constructor Details
#initialize(count) ⇒ Strict
Ctor.
count-
How many nodes to expect
32 33 34 |
# File 'lib/xembly/strict.rb', line 32 def initialize(count) @count = count.to_i end |
Instance Method Details
#exec(_, cursor) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/xembly/strict.rb', line 36 def exec(_, cursor) raise "there are #{cursor.length} nodes, while #{@count} expected" unless \ cursor.length == @count cursor end |