Class: Buhos::GraphML_Builder
- Inherits:
 - 
      Object
      
        
- Object
 - Buhos::GraphML_Builder
 
 
- Defined in:
 - lib/buhos/graphml_builder.rb
 
Overview
Builds a GraphML XML for a given systematic review and stage
Instance Method Summary collapse
- 
  
    
      #generate_graphml  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Return a string with GraphML XML.
 - 
  
    
      #initialize(sr, stage)  ⇒ GraphML_Builder 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of GraphML_Builder.
 - #prepare_stream(app) ⇒ Object
 
Constructor Details
#initialize(sr, stage) ⇒ GraphML_Builder
Returns a new instance of GraphML_Builder.
      36 37 38 39  | 
    
      # File 'lib/buhos/graphml_builder.rb', line 36 def initialize(sr, stage) @sr=sr @stage=stage end  | 
  
Instance Method Details
#generate_graphml ⇒ String
Return a string with GraphML XML
      42 43 44 45 46 47 48 49 50 51 52 53 54 55  | 
    
      # File 'lib/buhos/graphml_builder.rb', line 42 def generate_graphml ars=AnalysisSystematicReview.new(@sr) if @stage cd_hash=CanonicalDocument.where(:id=>@sr.cd_id_by_stage(@stage)).order(:year).as_hash else cd_hash=@sr.canonical_documents.order(:year).as_hash end head=build_head nodos = build_nodes(ars, cd_hash) edges= build_edges(ars, cd_hash) ="\n</graph>\n</graphml>" [head, nodos, edges, ].join("\n") end  | 
  
#prepare_stream(app) ⇒ Object
      57 58 59 60  | 
    
      # File 'lib/buhos/graphml_builder.rb', line 57 def prepare_stream(app) app.headers["Content-Disposition"] = "attachment;filename=graphml_review_#{@sr.id}_stage_#{@stage}.graphml" app.content_type 'application/graphml+xml' end  |