Class: BrmClient::Gateway::File

Inherits:
Object
  • Object
show all
Defined in:
lib/brm_client/gateway/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ File

Returns a new instance of File.



7
8
9
10
# File 'lib/brm_client/gateway/file.rb', line 7

def initialize opts
  @path = opts[:path] || "/tmp/#{opts[:application]}.log"
  @file = open(@path, "w")
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



6
7
8
# File 'lib/brm_client/gateway/file.rb', line 6

def file
  @file
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/brm_client/gateway/file.rb', line 6

def path
  @path
end

Instance Method Details

#disconnectObject



12
13
14
# File 'lib/brm_client/gateway/file.rb', line 12

def disconnect
  @file.close
end

#send_event(e) ⇒ Object



16
17
18
# File 'lib/brm_client/gateway/file.rb', line 16

def send_event e
  @file.write "#{e.to_json}\n"
end