Class: KRPC::Gen::ClassBase

Inherits:
Object
  • Object
show all
Includes:
Doc::SuffixMethods, Streaming::StreamConstructors
Defined in:
lib/krpc/gen.rb

Overview

Base class for service-defined class types.

Constant Summary

Constants included from Streaming::StreamConstructors

Streaming::StreamConstructors::STREAM_METHOD_REGEX, Streaming::StreamConstructors::STREAM_METHOD_SUFFIX

Constants included from Doc::SuffixMethods

Doc::SuffixMethods::DOCSTRING_SUFFIX, Doc::SuffixMethods::DOCSTRING_SUFFIX_REGEX

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Streaming::StreamConstructors

included, #method_missing, #respond_to_missing?

Methods included from Doc::SuffixMethods

included, #method_missing, #respond_to_missing?

Constructor Details

#initialize(client, remote_oid) ⇒ ClassBase

Returns a new instance of ClassBase.



129
130
131
# File 'lib/krpc/gen.rb', line 129

def initialize(client, remote_oid)
  @client, @remote_oid = client, remote_oid
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class KRPC::Streaming::StreamConstructors

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



123
124
125
# File 'lib/krpc/gen.rb', line 123

def client
  @client
end

#remote_oidObject (readonly)

Returns the value of attribute remote_oid.



123
124
125
# File 'lib/krpc/gen.rb', line 123

def remote_oid
  @remote_oid
end

Class Method Details

.krpc_nameObject



125
126
127
# File 'lib/krpc/gen.rb', line 125

def self.krpc_name
  name[11..-1]
end

Instance Method Details

#==(other) ⇒ Object



134
135
136
# File 'lib/krpc/gen.rb', line 134

def ==(other)
  other.class == self.class and other.remote_oid == remote_oid
end

#eql?Object



133
# File 'lib/krpc/gen.rb', line 133

alias_method :eql?, :==

#hashObject



137
138
139
# File 'lib/krpc/gen.rb', line 137

def hash
  remote_oid.hash
end

#inspectObject



145
146
147
# File 'lib/krpc/gen.rb', line 145

def inspect
  "#<#{self.class} ".green + "@remote_oid" + "=".green + remote_oid.to_s.bold.blue + ">".green
end

#to_sObject



141
142
143
# File 'lib/krpc/gen.rb', line 141

def to_s
  "#<#{self.class} @remote_oid=#{remote_oid}>"
end