Class: SocialFramework::NetworkHelper::GraphStrategy
- Inherits:
-
Object
- Object
- SocialFramework::NetworkHelper::GraphStrategy
- Defined in:
- app/helpers/social_framework/network_helper.rb
Overview
Define a Abstract Class to Network Graph
Direct Known Subclasses
Instance Attribute Summary collapse
-
#depth ⇒ Object
Maximum depth graph.
-
#network ⇒ Object
Array of verteces.
Class Method Summary collapse
-
.get_instance(id, elements_factory) ⇒ Object
- Get graph instance to user logged ====== Params:
id IntegerId of the user loggedelements_factory-
StringRepresent the factory class name to build Returns NotImplementedError.
- Get graph instance to user logged ====== Params:
Instance Method Summary collapse
-
#build(root, attributes, relationships) ⇒ Object
- Mount a graph from an user ====== Params:
root UserRoot user to mount graphattributesArrayAttributes will be added in vertexrelationships-
Arraylabels to find relationships, can be multiple in array or just one in a simple String, default is “all” thats represents all relationships existing Returns NotImplementedError.
- Mount a graph from an user ====== Params:
-
#destroy(id) ⇒ Object
- Destroy graph instance with id passed ====== Params:
id -
IntegerId of the user logged Returns NotImplementedError.
- Destroy graph instance with id passed ====== Params:
-
#search(map, search_in_progress, elements_number) ⇒ Object
- Search users with values specified in a map ====== Params:
map Hashwith keys and values to comparesearch_in_progressBooleanto continue if true or start a new searchelements_number-
Integerto limit max search result Returns NotImplementedError.
- Search users with values specified in a map ====== Params:
-
#suggest_relationships(type_relationships, amount_relationships) ⇒ Object
- Suggest relationships to root ====== Params:
type_relationships Arraylabels to find relationships, can be multiple in array or just one in a simple Stringamount_relationships-
Integerquantity of relationships to suggest a new relationship Returns NotImplementedError.
- Suggest relationships to root ====== Params:
Instance Attribute Details
#depth ⇒ Object
Maximum depth graph
13 14 15 |
# File 'app/helpers/social_framework/network_helper.rb', line 13 def depth @depth end |
#network ⇒ Object
Array of verteces
11 12 13 |
# File 'app/helpers/social_framework/network_helper.rb', line 11 def network @network end |
Class Method Details
.get_instance(id, elements_factory) ⇒ Object
Get graph instance to user logged
Params:
id-
IntegerId of the user logged elements_factory-
StringRepresent the factory class name to build
Returns NotImplementedError
24 25 26 |
# File 'app/helpers/social_framework/network_helper.rb', line 24 def self.get_instance(id, elements_factory) raise 'Must implement method in subclass' end |
Instance Method Details
#build(root, attributes, relationships) ⇒ Object
Mount a graph from an user
Params:
root-
UserRoot user to mount graph attributes-
ArrayAttributes will be added in vertex relationships-
Arraylabels to find relationships, can be multiple in array or just one in a simple String, default is “all” thats represents all relationships existing
Returns NotImplementedError
42 43 44 |
# File 'app/helpers/social_framework/network_helper.rb', line 42 def build(root, attributes, relationships) raise 'Must implement method in subclass' end |
#destroy(id) ⇒ Object
Destroy graph instance with id passed
Params:
id-
IntegerId of the user logged
Returns NotImplementedError
32 33 34 |
# File 'app/helpers/social_framework/network_helper.rb', line 32 def destroy(id) raise 'Must implement method in subclass' end |
#search(map, search_in_progress, elements_number) ⇒ Object
Search users with values specified in a map
Params:
map-
Hashwith keys and values to compare search_in_progress-
Booleanto continue if true or start a new search elements_number-
Integerto limit max search result
Returns NotImplementedError
52 53 54 |
# File 'app/helpers/social_framework/network_helper.rb', line 52 def search(map, search_in_progress, elements_number) raise 'Must implement method in subclass' end |
#suggest_relationships(type_relationships, amount_relationships) ⇒ Object
Suggest relationships to root
Params:
type_relationships-
Arraylabels to find relationships, can be multiple in array or just one in a simple String amount_relationships-
Integerquantity of relationships to suggest a new relationship
Returns NotImplementedError
61 62 63 |
# File 'app/helpers/social_framework/network_helper.rb', line 61 def suggest_relationships(type_relationships, amount_relationships) raise 'Must implement method in subclass' end |