Sha256: d0ccff33b781d51de358662024efcf682397efe54c74b08d38be42cf4676ec01

Contents?: true

Size: 791 Bytes

Versions: 5

Compression:

Stored size: 791 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'fathom'))
class Fathom::KnowledgeBase
  
  attr_reader :data_store
  
  def initialize(opts={})
    opts = OptionsHash.new(opts)
    @data_store = OpenStruct.new
  end
  
  def []=(key, value)
    @data_store.table[key] = value
  end
  
  def [](key)
    @data_store.table[key]
  end
  
  # This is temporary, but useful for now.  After we have the persisted KnowledgeBase, 
  # we'll create explicit accessor methods or a find syntax.
  def method_missing(sym, *args, &block)
    if @data_store.table.keys.include?(sym)
      @data_store.send(sym)
    else
      super
    end
  end
  
end

if __FILE__ == $0
  include Fathom
  # TODO: Is there anything you want to do to run this file on its own?
  # KnowledgeBase.new
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fathom-0.3.0 lib/fathom/knowledge_base.rb
fathom-0.2.3 lib/fathom/knowledge_base.rb
fathom-0.2.2 lib/fathom/knowledge_base.rb
fathom-0.2.1 lib/fathom/knowledge_base.rb
fathom-0.2.0 lib/fathom/knowledge_base.rb