Class: Bioroebe::Biomart::Server
- Inherits:
-
Object
- Object
- Bioroebe::Biomart::Server
- Includes:
- Bioroebe::Biomart
- Defined in:
- lib/bioroebe/biomart/server.rb
Instance Method Summary collapse
-
#alive? ⇒ Boolean
# === alive?.
-
#databases? ⇒ Hash
(also: #databases)
# === databases?.
-
#datasets? ⇒ Boolean
(also: #datasets)
# === datasets?.
-
#initialize(url) ⇒ Server
constructor
# === initialize ========================================================================= #.
-
#list_databases ⇒ Array
# === list_databases.
-
#list_datasets ⇒ Object
# === list_datasets.
-
#reset ⇒ Object
# === reset ========================================================================= #.
-
#url? ⇒ Boolean
(also: #url)
# === url? ========================================================================= #.
Methods included from Bioroebe::Biomart
Constructor Details
#initialize(url) ⇒ Server
#
initialize
#
22 23 24 25 26 27 28 |
# File 'lib/bioroebe/biomart/server.rb', line 22 def initialize(url) @url = url or raise ArgumentError, 'must pass :url' unless @url =~ /martservice/ @url = @url+'/martservice' end reset end |
Instance Method Details
#alive? ⇒ Boolean
#
alive?
Simple heartbeat function to test that a Biomart server is online. Returns true/false.
#
114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/bioroebe/biomart/server.rb', line 114 def alive? begin @databases = {} # reset the databases store self.list_databases rescue Biomart::BiomartError => error pp error return false else return true end end |
#databases? ⇒ Hash Also known as: databases
#
databases?
Returns a hash (keyed by the biomart 'name' for the database) of all of the Biomart::Database objects belonging to this server.
database name.
#
75 76 77 78 79 80 |
# File 'lib/bioroebe/biomart/server.rb', line 75 def databases? if @databases.empty? fetch_databases end return @databases end |
#datasets? ⇒ Boolean Also known as: datasets
#
datasets?
Returns a hash (keyed by the biomart 'name' for the dataset) of all of the Biomart::Dataset objects belonging to this server.
#
101 102 103 104 105 106 |
# File 'lib/bioroebe/biomart/server.rb', line 101 def datasets? if @datasets.empty? fetch_datasets end return @datasets end |
#list_databases ⇒ Array
#
list_databases
Returns an array of the database names (biomart 'name') for this dataset.
#
52 53 54 55 56 57 |
# File 'lib/bioroebe/biomart/server.rb', line 52 def list_databases if @databases.empty? fetch_databases end return @databases.keys end |
#list_datasets ⇒ Object
#
list_datasets
Returns an array of the dataset names (biomart 'name') for this dataset.
#
88 89 90 91 92 93 |
# File 'lib/bioroebe/biomart/server.rb', line 88 def list_datasets if @datasets.empty? fetch_datasets end return @datasets.keys end |
#reset ⇒ Object
#
reset
#
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bioroebe/biomart/server.rb', line 33 def reset # ======================================================================= # # === @databases # ======================================================================= # @databases = {} # ======================================================================= # # === @datasets # ======================================================================= # @datasets = {} end |
#url? ⇒ Boolean Also known as: url
#
url?
#
62 63 64 |
# File 'lib/bioroebe/biomart/server.rb', line 62 def url? @url end |