Class: BackpackTF::Response
- Inherits:
-
Object
- Object
- BackpackTF::Response
show all
- Defined in:
- lib/backpack_tf/response.rb
Class Method Summary
collapse
Class Method Details
.hash_keys_to_sym(hash) ⇒ Object
checks the data type of the keys of a Hash object if the key is a String, then changes it to a Symbol otherwise, leaves it as is
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/backpack_tf/response.rb', line 41
def self.hash_keys_to_sym hash
hash.each_pair.inject({}) do |new_hash, (key, val)|
unless key.class == String
new_hash[key] = val
else
new_hash[key.to_sym] = val
end
new_hash
end
end
|
.interface ⇒ Object
10
|
# File 'lib/backpack_tf/response.rb', line 10
def self.interface; @interface; end
|
.response ⇒ Object
35
36
|
# File 'lib/backpack_tf/response.rb', line 35
def self.response
end
|
.responses(key_val = nil) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/backpack_tf/response.rb', line 16
def self.responses key_val = nil
unless key_val.nil?
key_val = { key_val => nil } unless key_val.class == Hash
key = key_val.keys.first
val = key_val.values.first
if val.nil?
@responses[key]
elsif key == :reset && val == :confirm
@responses = {}
else
@responses[key] = hash_keys_to_sym(val)
end
end
@responses
end
|
.to_sym ⇒ Object
12
13
14
|
# File 'lib/backpack_tf/response.rb', line 12
def self.to_sym
self.name.to_sym
end
|