Module: RubyTorrent::AttrReaderQ

Included in:
PeerConnection
Defined in:
lib/rubytorrent/util.rb

Overview

boolean attributes now get question marks in their accessors don’t forget to ‘extend’ rather than ‘include’ this one

Instance Method Summary collapse

Instance Method Details

#attr_accessor_q(*args) ⇒ Object



159
160
161
162
# File 'lib/rubytorrent/util.rb', line 159

def attr_accessor_q(*args)
  attr_reader_q args
  attr_writer_q args
end

#attr_reader_q(*args) ⇒ Object



151
152
153
# File 'lib/rubytorrent/util.rb', line 151

def attr_reader_q(*args)
  args.each { |v| class_eval "def #{v}?; @#{v}; end" }
end

#attr_writer_q(*args) ⇒ Object



155
156
157
# File 'lib/rubytorrent/util.rb', line 155

def attr_writer_q(*args)
  args.each { |v| attr_writer v }
end