Sha256: f1bb564543623435460c35657577bc7c114a65a7a656ea9b645b8ea09a779ba0

Contents?: true

Size: 778 Bytes

Versions: 3

Compression:

Stored size: 778 Bytes

Contents

class MessageBuilder
  
  def initialize
    @address = ""
    @tags = []
    @values = []
    @time = nil
  end
  
  def with_address( addr )
    @address = addr
    self
  end
  
  def with_float( float )
    with_arg( "f", float )
    self
  end

  def with_double( double )
    with_arg( "d", double)
    self
  end
  
  def with_int( int )
    with_arg( "i", int )
    self
  end
  
  def with_string( string )
    with_arg( "s", string )
    self
  end
  
  def with_blob( blob )
    with_arg( "b", blob )
    self
  end
  
  def with_time( time )
    @time = time
  end
  
  def build
    message = OSC::Message.new( @address , *@values)
    message.time = @time
    message
  end
  
private

  def with_arg( tag, value )
    @tags << tag 
    @values << value 
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
osc-ruby-1.1.3 spec/builders/message_builder.rb
osc-ruby-1.1.2 spec/builders/message_builder.rb
osc-ruby-1.1.1 spec/builders/message_builder.rb