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.



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

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

Instance Method Details

#changesObject



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

def changes
  data.fetch(CHANGES)
end

#metaObject



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

def meta
  data[META]
end

#responsible_idObject



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

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

#timeObject



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

def time
  data.fetch(TS)
end

#versionObject



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

def version
  data.fetch(VERSION)
end