Module: CoreMIDI::Endpoint
Instance Attribute Summary (collapse)
-
- (Object) enabled
(also: #enabled?)
readonly
has the device been initialized?.
-
- (Object) entity
readonly
has the device been initialized?.
-
- (Object) id
has the device been initialized?.
-
- (Object) resource_id
readonly
has the device been initialized?.
-
- (Object) type
readonly
has the device been initialized?.
Class Method Summary (collapse)
-
+ (Object) all
all devices of both types.
-
+ (Object) all_by_type
a Hash of :input and :output devices.
-
+ (Object) first(type)
select the first device of type type.
-
+ (Object) last(type)
select the last device of type type.
Instance Method Summary (collapse)
-
- (Endpoint) initialize(resource_id, entity, options = {}, &block)
A new instance of Endpoint.
-
- (Boolean) online?
is this endpoint online?.
Instance Attribute Details
- (Object) enabled (readonly) Also known as: enabled?
has the device been initialized?
10 11 12 |
# File 'lib/coremidi/endpoint.rb', line 10 def enabled @enabled end |
- (Object) entity (readonly)
has the device been initialized?
10 11 12 |
# File 'lib/coremidi/endpoint.rb', line 10 def entity @entity end |
- (Object) id
has the device been initialized?
10 11 12 |
# File 'lib/coremidi/endpoint.rb', line 10 def id @id end |
- (Object) resource_id (readonly)
has the device been initialized?
10 11 12 |
# File 'lib/coremidi/endpoint.rb', line 10 def resource_id @resource_id end |
- (Object) type (readonly)
has the device been initialized?
10 11 12 |
# File 'lib/coremidi/endpoint.rb', line 10 def type @type end |
Class Method Details
+ (Object) all
all devices of both types
58 59 60 |
# File 'lib/coremidi/endpoint.rb', line 58 def self.all Device.all.map { |d| d.endpoints }.flatten end |
+ (Object) all_by_type
a Hash of :input and :output devices
50 51 52 53 54 55 |
# File 'lib/coremidi/endpoint.rb', line 50 def self.all_by_type { :input => Device.all.map { |d| d.endpoints[:input] }.flatten, :output => Device.all.map { |d| d.endpoints[:output] }.flatten } end |
+ (Object) first(type)
select the first device of type type
40 41 42 |
# File 'lib/coremidi/endpoint.rb', line 40 def self.first(type) all_by_type[type].first end |
+ (Object) last(type)
select the last device of type type
45 46 47 |
# File 'lib/coremidi/endpoint.rb', line 45 def self.last(type) all_by_type[type].last end |
Instance Method Details
- (Endpoint) initialize(resource_id, entity, options = {}, &block)
A new instance of Endpoint
22 23 24 25 26 27 |
# File 'lib/coremidi/endpoint.rb', line 22 def initialize(resource_id, entity, = {}, &block) @entity = entity @resource_id = resource_id @type = self.class.name.split('::').last.downcase.to_sym @enabled = false end |
- (Boolean) online?
is this endpoint online?
30 31 32 |
# File 'lib/coremidi/endpoint.rb', line 30 def online? @entity.online? && connect? end |