Class: Skynet::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/skynet-core/db/hippocampus.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil) ⇒ Queue

Returns a new instance of Queue.



13
14
15
# File 'lib/skynet-core/db/hippocampus.rb', line 13

def initialize(attributes = nil)
  self.attributes = attributes unless attributes.nil?
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def author
  @author
end

#brand_idObject

Returns the value of attribute brand_id.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def brand_id
  @brand_id
end

#created_atObject

Returns the value of attribute created_at.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def description
  @description
end

#integratedObject

Returns the value of attribute integrated.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def integrated
  @integrated
end

#network_typeObject

Returns the value of attribute network_type.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def network_type
  @network_type
end

#postObject

Returns the value of attribute post.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def post
  @post
end

#published_atObject

Returns the value of attribute published_at.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def published_at
  @published_at
end

#slot_1Object

Returns the value of attribute slot_1.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def slot_1
  @slot_1
end

#slot_2Object

Returns the value of attribute slot_2.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def slot_2
  @slot_2
end

#slot_3Object

Returns the value of attribute slot_3.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def slot_3
  @slot_3
end

#sourceObject

Returns the value of attribute source.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def source
  @source
end

#tracked_network_idObject

Returns the value of attribute tracked_network_id.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def tracked_network_id
  @tracked_network_id
end

#urlObject

Returns the value of attribute url.



9
10
11
# File 'lib/skynet-core/db/hippocampus.rb', line 9

def url
  @url
end

Class Method Details

.create(attributes = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/skynet-core/db/hippocampus.rb', line 27

def self.create(attributes = nil)
  if attributes.is_a?(Array)
    attributes.collect { |attr| create(attr) }
  else
    object = new(attributes)
    object.save
    object
  end
end

Instance Method Details

#saveObject



17
18
19
20
21
22
23
24
25
# File 'lib/skynet-core/db/hippocampus.rb', line 17

def save
  output = false
  if uniqueness?
    Skynet.queue << to_hash
    Skynet.queue.flush
    output = true
  end if required?
  output
end