Class: EasyType::NodeGroup
- Inherits:
-
Object
- Object
- EasyType::NodeGroup
- Defined in:
- lib/easy_type/node_group.rb
Overview
Simple wrapper arround a node group
Instance Attribute Summary collapse
-
#parent_name ⇒ Object
readonly
Returns the value of attribute parent_name.
Instance Method Summary collapse
-
#em_group ⇒ Object
The top level group containin all licensed nodes.
- #em_group? ⇒ Boolean
- #full_name ⇒ Object
-
#initialize(classifier, data) ⇒ NodeGroup
constructor
A new instance of NodeGroup.
- #matching_nodes ⇒ Object
- #method_missing(method) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
24 25 26 27 28 |
# File 'lib/easy_type/node_group.rb', line 24 def method_missing(method) str = method.id2name raise NoMethodError.new("undefined method `#{method}' for #{name}:EasyType::NodeGroup") if @data[str].nil? @data[str] end |
Instance Attribute Details
#parent_name ⇒ Object (readonly)
Returns the value of attribute parent_name.
7 8 9 |
# File 'lib/easy_type/node_group.rb', line 7 def parent_name @parent_name end |
Instance Method Details
#em_group ⇒ Object
The top level group containin all licensed nodes
20 21 22 |
# File 'lib/easy_type/node_group.rb', line 20 def em_group 'EM licensed nodes' end |
#em_group? ⇒ Boolean
42 43 44 |
# File 'lib/easy_type/node_group.rb', line 42 def em_group? full_name.include?(em_group) end |
#full_name ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/easy_type/node_group.rb', line 30 def full_name value = [name] current_group = self while true do parent_group = @@all_groups.find {|g| g.id == current_group.parent } break if current_group.id == parent_group.id value << parent_group.name current_group = parent_group end "/#{value.reverse.join('/')}" end |
#matching_nodes ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/easy_type/node_group.rb', line 46 def matching_nodes if @data['rule'] pdb_query = @classifier.rule_to_pdb_query(@data['rule']) @@pdb.nodes(pdb_query['query']) else [] end end |