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.



173
174
175
176
177
178
# File 'lib/bel/namespace.rb', line 173

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

Instance Attribute Details

#annotationsObject



185
186
187
188
# File 'lib/bel/namespace.rb', line 185

def annotations
  read_index if not @loaded
  @annotations
end

#namespacesObject



180
181
182
183
# File 'lib/bel/namespace.rb', line 180

def namespaces
  read_index if not @loaded
  @namespaces
end

Class Method Details

.openbel_published_index(version) ⇒ Object



164
165
166
167
# File 'lib/bel/namespace.rb', line 164

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



190
191
192
193
194
# File 'lib/bel/namespace.rb', line 190

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

#each_annotationObject



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

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

#each_namespaceObject



196
197
198
199
# File 'lib/bel/namespace.rb', line 196

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

#to_belObject



206
207
208
# File 'lib/bel/namespace.rb', line 206

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