Class: BEL::Namespace::ResourceIndex

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bel/namespace.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index, namespaces = [], annotations = []) ⇒ ResourceIndex

Returns a new instance of ResourceIndex.



170
171
172
173
174
175
# File 'lib/bel/namespace.rb', line 170

def initialize(index, namespaces = [], annotations = [])
  @index = index
  @namespaces = namespaces
  @annotations = annotations
  @loaded = false
end

Instance Attribute Details

#annotationsObject



182
183
184
185
# File 'lib/bel/namespace.rb', line 182

def annotations
  read_index if not @loaded
  @annotations
end

#namespacesObject



177
178
179
180
# File 'lib/bel/namespace.rb', line 177

def namespaces
  read_index if not @loaded
  @namespaces
end

Class Method Details

.openbel_published_index(version) ⇒ Object



161
162
163
164
# File 'lib/bel/namespace.rb', line 161

def openbel_published_index(version)
  clean = version.to_s.strip
  ResourceIndex.new("http://resource.belframework.org/belframework/#{clean}/index.xml")
end

Instance Method Details

#eachObject



187
188
189
190
191
# File 'lib/bel/namespace.rb', line 187

def each
  read_index if not @loaded
  @namespaces.each { |x| yield x }
  @annotations.each { |x| yield x }
end

#each_annotationObject



198
199
200
201
# File 'lib/bel/namespace.rb', line 198

def each_annotation
  read_index if not @loaded
  @annotations.each { |x| yield x }
end

#each_namespaceObject



193
194
195
196
# File 'lib/bel/namespace.rb', line 193

def each_namespace
  read_index if not @loaded
  @namespaces.each { |x| yield x }
end

#to_belObject



203
204
205
# File 'lib/bel/namespace.rb', line 203

def to_bel
  map { |x| x.to_bel }
end