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
30 31 32 |
# File 'lib/xembly/strict.rb', line 30 def initialize(count) @count = count.to_i end |
Instance Method Details
#exec(_, cursor) ⇒ Object
34 35 36 37 38 |
# File 'lib/xembly/strict.rb', line 34 def exec(_, cursor) fail "there are #{cursor.length} nodes, while #{@count} expected" unless \ cursor.length == @count cursor end |