Class: Biomart::Server

Inherits:
Object
  • Object
show all
Includes:
Biomart
Defined in:
lib/biomart/server.rb

Overview

Class representation for a biomart server. Will contain many Biomart::Database and Biomart::Dataset objects.

Constant Summary

Constants included from Biomart

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Biomart

#request

Constructor Details

#initialize(url) ⇒ Server

Returns a new instance of Server.



9
10
11
12
13
14
15
16
17
# File 'lib/biomart/server.rb', line 9

def initialize( url )
  @url = url or raise ArgumentError, "must pass :url"
  unless @url =~ /martservice/
    @url = @url + "/martservice"
  end
  
  @databases = {}
  @datasets  = {}
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/biomart/server.rb', line 7

def url
  @url
end

Instance Method Details

#databasesObject

Returns a hash (keyed by the biomart ‘name’ for the database) of all of the Biomart::Database objects belonging to this server.



30
31
32
33
34
35
# File 'lib/biomart/server.rb', line 30

def databases
  if @databases.empty?
    fetch_databases
  end
  return @databases
end

#datasetsObject

Returns a hash (keyed by the biomart ‘name’ for the dataset) of all of the Biomart::Dataset objects belonging to this server.



48
49
50
51
52
53
# File 'lib/biomart/server.rb', line 48

def datasets
  if @datasets.empty?
    fetch_datasets
  end
  return @datasets
end

#list_databasesObject

Returns an array of the database names (biomart ‘name’) for this dataset.



21
22
23
24
25
26
# File 'lib/biomart/server.rb', line 21

def list_databases
  if @databases.empty?
    fetch_databases
  end
  return @databases.keys
end

#list_datasetsObject

Returns an array of the dataset names (biomart ‘name’) for this dataset.



39
40
41
42
43
44
# File 'lib/biomart/server.rb', line 39

def list_datasets
  if @datasets.empty?
    fetch_datasets
  end
  return @datasets.keys
end