Class: PgqEvent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pgq_tuple = nil, use_yaml = true) ⇒ PgqEvent

Returns a new instance of PgqEvent.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pgq_event.rb', line 4

def initialize pgq_tuple = nil, use_yaml = true
  if pgq_tuple.is_a? Hash
    @id = pgq_tuple['ev_id']
    @type = pgq_tuple['ev_type']
    if use_yaml
      @data = YAML.load pgq_tuple['ev_data']
      @extra1 = YAML.load pgq_tuple['extra1'] if pgq_tuple['extra1']
      @extra2 = YAML.load pgq_tuple['extra2'] if pgq_tuple['extra2']
      @extra3 = YAML.load pgq_tuple['extra3'] if pgq_tuple['extra3']
      @extra4 = YAML.load pgq_tuple['extra4'] if pgq_tuple['extra4']
    else
      @data = pgq_tuple['ev_data']
      @extra1 = pgq_tuple['extra1']
      @extra2 = pgq_tuple['extra2']
      @extra3 = pgq_tuple['extra3']
      @extra4 = pgq_tuple['extra4']
    end
  end
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



2
3
4
# File 'lib/pgq_event.rb', line 2

def data
  @data
end

#extra1Object

Returns the value of attribute extra1.



2
3
4
# File 'lib/pgq_event.rb', line 2

def extra1
  @extra1
end

#extra2Object

Returns the value of attribute extra2.



2
3
4
# File 'lib/pgq_event.rb', line 2

def extra2
  @extra2
end

#extra3Object

Returns the value of attribute extra3.



2
3
4
# File 'lib/pgq_event.rb', line 2

def extra3
  @extra3
end

#extra4Object

Returns the value of attribute extra4.



2
3
4
# File 'lib/pgq_event.rb', line 2

def extra4
  @extra4
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/pgq_event.rb', line 2

def id
  @id
end

#typeObject

Returns the value of attribute type.



2
3
4
# File 'lib/pgq_event.rb', line 2

def type
  @type
end