Class: OSC::Message
- Inherits:
-
Object
- Object
- OSC::Message
- Defined in:
- lib/osc-ruby/message.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#ip_port ⇒ Object
Returns the value of attribute ip_port.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #encode ⇒ Object
-
#initialize(address, *args) ⇒ Message
constructor
A new instance of Message.
- #tags ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(address, *args) ⇒ Message
Returns a new instance of Message.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/osc-ruby/message.rb', line 14 def initialize(address, *args) @address = address @args = [] args.each do |arg| case arg when Integer; @args << OSCInt32.new(arg) when Float; @args << OSCFloat32.new(arg) when String; @args << OSCString.new(arg) when OSCArgument; @args << arg end end end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
3 4 5 |
# File 'lib/osc-ruby/message.rb', line 3 def address @address end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
5 6 7 |
# File 'lib/osc-ruby/message.rb', line 5 def ip_address @ip_address end |
#ip_port ⇒ Object
Returns the value of attribute ip_port.
6 7 8 |
# File 'lib/osc-ruby/message.rb', line 6 def ip_port @ip_port end |
#time ⇒ Object
Returns the value of attribute time.
4 5 6 |
# File 'lib/osc-ruby/message.rb', line 4 def time @time end |
Class Method Details
.new_with_time(address, time, tags = nil, *args) ⇒ Object
8 9 10 11 12 |
# File 'lib/osc-ruby/message.rb', line 8 def self.new_with_time(address, time, =nil, *args) = new(address, , *args) .time = time end |
Instance Method Details
#==(other) ⇒ Object
42 43 44 |
# File 'lib/osc-ruby/message.rb', line 42 def ==(other) @address == other.address && to_a == other.to_a end |
#encode ⇒ Object
32 33 34 35 36 |
# File 'lib/osc-ruby/message.rb', line 32 def encode s = OSCString.new(@address).encode s << OSCString.new(',' + ).encode s << @args.collect{|x| x.encode}.join end |
#tags ⇒ Object
28 29 30 |
# File 'lib/osc-ruby/message.rb', line 28 def @args.collect{|x| x.tag}.join end |
#to_a ⇒ Object
38 39 40 |
# File 'lib/osc-ruby/message.rb', line 38 def to_a @args.collect{|x| x.val} end |