Class: DoingStream::Stream::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/doing_stream/stream/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



5
6
7
# File 'lib/doing_stream/stream/entry.rb', line 5

def data
  @data
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/doing_stream/stream/entry.rb', line 5

def name
  @name
end

Instance Method Details

#publishedObject



6
7
8
9
10
# File 'lib/doing_stream/stream/entry.rb', line 6

def published
  published = data['published']
  published = Time.new published unless published.is_a? Time
  published
end

#to_hObject



12
13
14
# File 'lib/doing_stream/stream/entry.rb', line 12

def to_h
  { 'feed_name' => name, name => 'true', 'published' => published, 'data' => data }
end

#to_jsonObject



16
17
18
# File 'lib/doing_stream/stream/entry.rb', line 16

def to_json
  to_h.to_json
end