Class: Servent::Event

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

Defined Under Namespace

Classes: InvalidError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ Event

Returns a new instance of Event.

Raises:



13
14
15
16
17
18
19
20
# File 'lib/servent/event.rb', line 13

def initialize(event)
  @data = []
  StringIO.open(event) do |io|
    io.each_line { |line| parse_line line }
  end

  raise InvalidError.new(event) if empty?
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/servent/event.rb', line 11

def id
  @id
end

#retryObject (readonly)

Returns the value of attribute retry.



11
12
13
# File 'lib/servent/event.rb', line 11

def retry
  @retry
end

#typeObject (readonly)

Returns the value of attribute type.



11
12
13
# File 'lib/servent/event.rb', line 11

def type
  @type
end

Instance Method Details

#dataObject



22
23
24
# File 'lib/servent/event.rb', line 22

def data
  @_data ||= @data.join("\n")
end