Class: Parslet::Pattern::SubtreeBind

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

Overview

Used internally for representing a bind placeholder in a Parslet::Transform pattern. This is the superclass for all bindings.

It defines the most permissive kind of bind, the one that matches any subtree whatever it looks like.

Direct Known Subclasses

SequenceBind, SimpleBind

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#symbolObject

Returns the value of attribute symbol

Returns:

  • (Object)

    the current value of symbol



8
9
10
# File 'lib/parslet/pattern/binding.rb', line 8

def symbol
  @symbol
end

Instance Method Details

#can_bind?(subtree) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/parslet/pattern/binding.rb', line 17

def can_bind?(subtree)
  true
end

#inspectObject



13
14
15
# File 'lib/parslet/pattern/binding.rb', line 13

def inspect
  "#{bind_type_name}(#{symbol.inspect})"
end

#variable_nameObject



9
10
11
# File 'lib/parslet/pattern/binding.rb', line 9

def variable_name
  symbol
end