Class: FileChannel

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

Overview

FileChannel - channel to hold queues and topics

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_location) ⇒ FileChannel

Returns a new instance of FileChannel.



9
10
11
12
13
14
15
# File 'lib/file_channel.rb', line 9

def initialize(root_location)
  @channel_name = SecureRandom.hex(20).to_s
  @channel_location = root_location + '/' + @channel_name

  FileUtils.mkdir_p @channel_location
  @topics = {}
end

Instance Attribute Details

#channel_nameObject (readonly)

Returns the value of attribute channel_name.



7
8
9
# File 'lib/file_channel.rb', line 7

def channel_name
  @channel_name
end

Instance Method Details

#queueObject



21
22
23
# File 'lib/file_channel.rb', line 21

def queue
  FileQueue.new
end

#topic(topic_name) ⇒ Object



17
18
19
# File 'lib/file_channel.rb', line 17

def topic(topic_name)
  @topics[topic_name] = FileTopic.new(@channel_location, topic_name)
end