Class: WTT::Core::MetaData

Inherits:
Object
  • Object
show all
Defined in:
lib/wtt/core/meta_data.rb

Overview

Bucket for holding data in the wtt file

Constant Summary collapse

STORAGE_SECTION =
'meta'

Instance Method Summary collapse

Constructor Details

#initialize(storage) ⇒ MetaData

Returns a new instance of MetaData.

Parameters:

  • storage (Storage)

    Where to read//write



12
13
14
15
# File 'lib/wtt/core/meta_data.rb', line 12

def initialize(storage)
  @storage = storage
  read!
end

Instance Method Details

#[](name) ⇒ Object



25
26
27
# File 'lib/wtt/core/meta_data.rb', line 25

def [](name)
  @data[name]
end

#[]=(name, value) ⇒ Object



29
30
31
# File 'lib/wtt/core/meta_data.rb', line 29

def []=(name, value)
  @data[name] = value
end

#anchored_commitObject



17
18
19
# File 'lib/wtt/core/meta_data.rb', line 17

def anchored_commit
  @data['anchored_commit']
end

#anchored_commit=(val) ⇒ Object



21
22
23
# File 'lib/wtt/core/meta_data.rb', line 21

def anchored_commit=(val)
  @data['anchored_commit'] = val
end

#read!Object



33
34
35
# File 'lib/wtt/core/meta_data.rb', line 33

def read!
  @data = @storage.read(STORAGE_SECTION)
end

#write!Object



37
38
39
# File 'lib/wtt/core/meta_data.rb', line 37

def write!
  @storage.write!(STORAGE_SECTION, @data)
end