Class: CoreMIDI::Entity
- Inherits:
-
Object
- Object
- CoreMIDI::Entity
- Defined in:
- lib/coremidi/entity.rb
Instance Attribute Summary collapse
-
#endpoints ⇒ Object
readonly
Returns the value of attribute endpoints.
-
#is_online ⇒ Object
readonly
Returns the value of attribute is_online.
-
#manufacturer ⇒ Object
readonly
Returns the value of attribute manufacturer.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(resource, options = {}, &block) ⇒ Entity
constructor
A new instance of Entity.
-
#online? ⇒ Boolean
Is the entity online?.
-
#populate_endpoint_ids(starting_id) ⇒ Fixnum
Assign all of this Entity’s endpoints an consecutive local id.
Constructor Details
#initialize(resource, options = {}, &block) ⇒ Entity
Returns a new instance of Entity.
14 15 16 17 18 19 20 21 |
# File 'lib/coremidi/entity.rb', line 14 def initialize(resource, = {}, &block) @endpoints = { :source => [], :destination => [] } @resource = resource populate end |
Instance Attribute Details
#endpoints ⇒ Object (readonly)
Returns the value of attribute endpoints.
5 6 7 |
# File 'lib/coremidi/entity.rb', line 5 def endpoints @endpoints end |
#is_online ⇒ Object (readonly)
Returns the value of attribute is_online.
5 6 7 |
# File 'lib/coremidi/entity.rb', line 5 def is_online @is_online end |
#manufacturer ⇒ Object (readonly)
Returns the value of attribute manufacturer.
5 6 7 |
# File 'lib/coremidi/entity.rb', line 5 def manufacturer @manufacturer end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/coremidi/entity.rb', line 5 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/coremidi/entity.rb', line 5 def name @name end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
5 6 7 |
# File 'lib/coremidi/entity.rb', line 5 def resource @resource end |
Instance Method Details
#online? ⇒ Boolean
Is the entity online?
37 38 39 |
# File 'lib/coremidi/entity.rb', line 37 def online? get_property(:offline, :type => :int) == 0 end |
#populate_endpoint_ids(starting_id) ⇒ Fixnum
Assign all of this Entity’s endpoints an consecutive local id
26 27 28 29 30 31 32 33 |
# File 'lib/coremidi/entity.rb', line 26 def populate_endpoint_ids(starting_id) counter = 0 @endpoints.values.flatten.each do |endpoint| endpoint.id = counter + starting_id counter += 1 end counter end |