16 lines
338 B
Crystal
16 lines
338 B
Crystal
require "./node_filter"
|
|
|
|
module Spectator
|
|
# Filter that matches nodes based on their name.
|
|
class NameNodeFilter < NodeFilter
|
|
# Creates the node filter.
|
|
def initialize(@name : String)
|
|
end
|
|
|
|
# Checks whether the node satisfies the filter.
|
|
def includes?(node) : Bool
|
|
node.to_s.includes?(@name)
|
|
end
|
|
end
|
|
end
|