Class: TestServer::Encoder
- Inherits:
-
Object
- Object
- TestServer::Encoder
show all
- Includes:
- Comparable
- Defined in:
- lib/test_server/encoder.rb
Instance Method Summary
collapse
Instance Method Details
#<=>(other) ⇒ Object
30
31
32
|
# File 'lib/test_server/encoder.rb', line 30
def <=>(other)
name <=> other.name
end
|
#decode(string) ⇒ Object
14
15
16
|
# File 'lib/test_server/encoder.rb', line 14
def decode(string)
fail NotImplementedError, JSON.dump(method: 'decode')
end
|
#encode(string) ⇒ Object
10
11
12
|
# File 'lib/test_server/encoder.rb', line 10
def encode(string)
fail NotImplementedError, JSON.dump(method: 'encode')
end
|
#eql?(other) ⇒ Boolean
22
23
24
|
# File 'lib/test_server/encoder.rb', line 22
def eql?(other)
name? other.name
end
|
#find_by_name(name) ⇒ Object
34
35
36
37
|
# File 'lib/test_server/encoder.rb', line 34
def find_by_name(name)
rescue NameError
raise
end
|
#hash ⇒ Object
26
27
28
|
# File 'lib/test_server/encoder.rb', line 26
def hash
Digest::SHA1.hexdigest name.to_s
end
|
#name ⇒ Object
6
7
8
|
# File 'lib/test_server/encoder.rb', line 6
def name
self.class.to_s.demodulize.underscore.to_sym
end
|
#name?(n) ⇒ Boolean
18
19
20
|
# File 'lib/test_server/encoder.rb', line 18
def name?(n)
name == n
end
|