Class: Parslet::Pattern::SequenceBind

Inherits:
SubtreeBind
  • Object
show all
Defined in:
lib/parslet/pattern/binding.rb

Overview

Binds a symbol to a sequence of simple leafs ([element1, element2, …])

Instance Attribute Summary

Attributes inherited from SubtreeBind

#symbol

Instance Method Summary collapse

Methods inherited from SubtreeBind

#inspect, #variable_name

Instance Method Details

#can_bind?(subtree) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/parslet/pattern/binding.rb', line 45

def can_bind?(subtree)
  subtree.kind_of?(Array) &&
    (not subtree.any? { |el| [Hash, Array].include?(el.class) })
end