Class: EventCore::IOSource

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Source

#closed?, #event_factory, #notify_trigger, #ready!, #ready?, #timeout, #trigger

Constructor Details

#initialize(io, type) ⇒ IOSource

Returns a new instance of IOSource.



169
170
171
172
173
174
175
176
# File 'lib/event_core.rb', line 169

def initialize(io, type)
  super()
  raise "Nil IO provided" if io.nil?
  @io = io
  @type = type
  @auto_close = true
  raise "Invalid select type: #{type}" unless [:read, :write].include?(type)
end

Instance Attribute Details

#auto_closeObject

Returns the value of attribute auto_close.



167
168
169
# File 'lib/event_core.rb', line 167

def auto_close
  @auto_close
end

Instance Method Details

#close!Object



190
191
192
193
# File 'lib/event_core.rb', line 190

def close!
  super
  @io.close if @auto_close and not @io.closed?
end

#consume_event_data!Object



186
187
188
# File 'lib/event_core.rb', line 186

def consume_event_data!
  nil
end

#select_ioObject



178
179
180
# File 'lib/event_core.rb', line 178

def select_io
  @io
end

#select_typeObject



182
183
184
# File 'lib/event_core.rb', line 182

def select_type
  @type
end