Class: Logidze::History::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/logidze/history/version.rb

Overview

Represents one log item

Constant Summary collapse

TS =

Timestamp key

'ts'
CHANGES =

Changes key

'c'
RESPONSIBLE =

Responsible ID

'r'
META_RESPONSIBLE =

Meta Responsible ID

'_r'
META =

Meta key

'm'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Version

Returns a new instance of Version.



19
20
21
# File 'lib/logidze/history/version.rb', line 19

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



17
18
19
# File 'lib/logidze/history/version.rb', line 17

def data
  @data
end

Instance Method Details

#changesObject



27
28
29
# File 'lib/logidze/history/version.rb', line 27

def changes
  data.fetch(CHANGES)
end

#metaObject



39
40
41
# File 'lib/logidze/history/version.rb', line 39

def meta
  data[META]
end

#responsible_idObject



35
36
37
# File 'lib/logidze/history/version.rb', line 35

def responsible_id
  meta && meta[META_RESPONSIBLE] || data[RESPONSIBLE]
end

#timeObject



31
32
33
# File 'lib/logidze/history/version.rb', line 31

def time
  data.fetch(TS)
end

#versionObject



23
24
25
# File 'lib/logidze/history/version.rb', line 23

def version
  data.fetch(VERSION)
end