Class: Logux::Meta
- Inherits:
-
Hash
- Object
- Hash
- Logux::Meta
- Defined in:
- lib/logux/meta.rb
Instance Method Summary collapse
- #client_id ⇒ Object
- #id ⇒ Object
-
#initialize(source_hash = {}) ⇒ Meta
constructor
A new instance of Meta.
- #logux_order ⇒ Object
- #node_id ⇒ Object
- #time ⇒ Object
- #user_id ⇒ Object
Constructor Details
#initialize(source_hash = {}) ⇒ Meta
Returns a new instance of Meta.
5 6 7 8 9 10 |
# File 'lib/logux/meta.rb', line 5 def initialize(source_hash = {}) merge!(source_hash.stringify_keys) self['id'] ||= Logux.generate_action_id self['time'] ||= self['id'].split(' ')[0] end |
Instance Method Details
#client_id ⇒ Object
20 21 22 |
# File 'lib/logux/meta.rb', line 20 def client_id node_id.split(':')[0..1].join(':') end |
#id ⇒ Object
32 33 34 |
# File 'lib/logux/meta.rb', line 32 def id fetch('id') end |
#logux_order ⇒ Object
24 25 26 |
# File 'lib/logux/meta.rb', line 24 def logux_order time + ' ' + id.split(' ')[1..-1].join(' ') end |
#node_id ⇒ Object
12 13 14 |
# File 'lib/logux/meta.rb', line 12 def node_id id.split(' ')[1] end |
#time ⇒ Object
28 29 30 |
# File 'lib/logux/meta.rb', line 28 def time fetch('time') end |
#user_id ⇒ Object
16 17 18 |
# File 'lib/logux/meta.rb', line 16 def user_id node_id.split(':')[0] end |