Class: RedfishTools::DataStore

Inherits:
Object
  • Object
show all
Defined in:
lib/redfish_tools/datastore.rb

Defined Under Namespace

Classes: Resource

Instance Method Summary collapse

Constructor Details

#initialize(base_path) ⇒ DataStore

Returns a new instance of DataStore.



9
10
11
12
13
# File 'lib/redfish_tools/datastore.rb', line 9

def initialize(base_path)
  # TODO(tadeboro): check for folder and determine mode of operation
  @base_path = File.expand_path(base_path)
  @overlay = {}
end

Instance Method Details

#get(id) ⇒ Object



15
16
17
18
# File 'lib/redfish_tools/datastore.rb', line 15

def get(id)
  id = id.chomp("/")
  @overlay[id] || load_resource(id)
end

#set(id, body, headers: nil, time: nil) ⇒ Object



20
21
22
# File 'lib/redfish_tools/datastore.rb', line 20

def set(id, body, headers: nil, time: nil)
  @overlay[id] = Resource.new(id, body, headers, time)
end