Module: Cuporter::Node::Tagged

Overview

a node with a list of tags that can be applied to all children

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filterObject

Returns the value of attribute filter.



7
8
9
# File 'lib/cuporter/node/tagged_node.rb', line 7

def filter
  @filter
end

Instance Method Details

#filter_child(node, context_tags = []) ⇒ Object



15
16
17
# File 'lib/cuporter/node/tagged_node.rb', line 15

def filter_child(node, context_tags = [])
  add_child(node) if @filter.pass?(context_tags | tags | node.tags)
end

#has_tags?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/cuporter/node/tagged_node.rb', line 9

def has_tags?
  tags.size > 0
end

#tagsObject



12
13
14
# File 'lib/cuporter/node/tagged_node.rb', line 12

def tags
  @tags ||= attributes["tags"].to_s.split(/,\s*/) || []
end