Class: Chromecast::Channel::Base
- Inherits:
-
Object
- Object
- Chromecast::Channel::Base
- Defined in:
- lib/chromecast/channel/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(connection, namespace, type) ⇒ Base
constructor
A new instance of Base.
- #send(data) ⇒ Object
Constructor Details
#initialize(connection, namespace, type) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 |
# File 'lib/chromecast/channel/base.rb', line 6 def initialize connection, namespace, type self.connection = connection self.namespace = namespace self.type = type end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
4 5 6 |
# File 'lib/chromecast/channel/base.rb', line 4 def connection @connection end |
#namespace ⇒ Object
Returns the value of attribute namespace.
4 5 6 |
# File 'lib/chromecast/channel/base.rb', line 4 def namespace @namespace end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/chromecast/channel/base.rb', line 4 def type @type end |
Instance Method Details
#send(data) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/chromecast/channel/base.rb', line 12 def send data #puts "SEND: #{data}" #puts "" msg = (data) encoded = msg.encode size = [encoded.size].pack('N') connection.write(size + encoded) return nil end |