Sha256: 84b369d48bdde89dc393f048298e079f122630a7aac4894ddbb8f0fc8c4122b7
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
require 'stf/model/device' module Stf # can not inherite from Array because http://words.steveklabnik.com/beware-subclassing-ruby-core-classes class DeviceList def initialize(devices) if devices.nil? @devices = Array.new else @devices = devices.map {|d| (d.kind_of? Device) ? d : Device.new(d)} end end def byFilter(filter) filter ? select {|d| d.checkFilter(filter)} : Array.new end def exceptFilter(filter) filter ? reject {|d| d.checkFilter(filter)} : this end def filterReadyToConnect select {|d| d.ready == true && d.present == true && d.usage.nil? } end def asConnectUrlList @devices.map {|d| d.remoteConnectUrl} end def select DeviceList.new(@devices.select {|d| yield(d)}) end def reject DeviceList.new(@devices.select {|d| !yield(d)}) end def empty? @devices.empty? end def size @devices.size end def asArray @devices end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stf-client-0.3.0.rc9 | lib/stf/model/device_list.rb |