Class: Logsaber::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/logsaber/entry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(primary, secondary) ⇒ Entry

Returns a new instance of Entry.


8
9
10
# File 'lib/logsaber/entry.rb', line 8

def initialize primary, secondary
  @primary, @secondary = primary, secondary
end

Instance Attribute Details

#primaryObject (readonly)

Returns the value of attribute primary.


11
12
13
# File 'lib/logsaber/entry.rb', line 11

def primary
  @primary
end

Class Method Details

.create(all_details, &block) ⇒ Object


3
4
5
6
# File 'lib/logsaber/entry.rb', line 3

def self.create all_details, &block
  all_details << block.call if block
  new all_details.shift, Array(all_details)
end

Instance Method Details

#parseObject


13
14
15
16
17
18
19
20
21
# File 'lib/logsaber/entry.rb', line 13

def parse
  {
    label: label,
    info: info,
    primary: primary,
    secondary: secondary,
    object: value
   }
end