Class: Connect::Datasources::Base
- Inherits:
 - 
      Object
      
        
- Object
 - Connect::Datasources::Base
 
 
- Defined in:
 - lib/connect/datasources/base.rb
 
Overview
This a a base level class for all datasources. A Datasources allows you to import data from an other source into connect. A datasource must implement the ‘lookup(name)` method. This method must return a value. A value can be any of:
- 
Integer
 - 
Float
 - 
String
 - 
Array
 - 
Hash
 - 
Bolean
 
Instance Method Summary collapse
- 
  
    
      #initialize(_name, *_arguments)  ⇒ Datasource::Base 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
The initializer is called by the parser.
 - 
  
    
      #lookup(_key)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
The lookup method is called for every variable in a import block “‘ import from datasource(param1, param2) do.…
 
Constructor Details
#initialize(_name, *_arguments) ⇒ Datasource::Base
The initializer is called by the parser. When the parser encounters a “‘ import from datasource(param1, param2) do.… “` The a datasource is instantiated. The params are passed as params to the ` initialize` function.
      28 29  | 
    
      # File 'lib/connect/datasources/base.rb', line 28 def initialize(_name, *_arguments) end  | 
  
Instance Method Details
#lookup(_key) ⇒ Object
The lookup method is called for every variable in a import block “‘ import from datasource(param1, param2) do.…
value1 = 'lookup_1'
value2 = 'lookp_2'
“‘ will call lookup twice.
      44 45 46  | 
    
      # File 'lib/connect/datasources/base.rb', line 44 def lookup(_key) fail ArgumentError, 'lookup method needs to be overridden in datasource' end  |