Class: Aspen::Adapters::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/aspen/adapters.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



20
21
22
23
24
25
26
27
# File 'lib/aspen/adapters.rb', line 20

def initialize
  @data ||= {
    cypher: Adapter.new(id: :cypher, name: "Cypher", ext: '.cql' ),
    json:   Adapter.new(id: :json,   name: "JSON",   ext: '.json'),
    gexf:   Adapter.new(id: :gexf,   name: "GEXF",   ext: '.gexf'),
  }
  Aspen.available_formats = @data.keys
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



18
19
20
# File 'lib/aspen/adapters.rb', line 18

def data
  @data
end

Class Method Details

.get(key) ⇒ Object



29
30
31
32
33
# File 'lib/aspen/adapters.rb', line 29

def self.get(key)
  # @todo There's a better design for this.
  @@store ||= new.data
  @@store.fetch(key)
end