json-rpc-objects 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES.txt +5 -0
  3. data/Gemfile +3 -1
  4. data/Gemfile.lock +63 -12
  5. data/LICENSE.txt +1 -1
  6. data/README.md +40 -41
  7. data/Rakefile +2 -2
  8. data/VERSION +1 -1
  9. data/json-rpc-objects.gemspec +25 -11
  10. data/lib/json-rpc-objects/error.rb +1 -1
  11. data/lib/json-rpc-objects/exceptions/invalid-code.rb +25 -0
  12. data/lib/json-rpc-objects/generic.rb +2 -2
  13. data/lib/json-rpc-objects/generic/error.rb +1 -1
  14. data/lib/json-rpc-objects/generic/object.rb +4 -5
  15. data/lib/json-rpc-objects/generic/request.rb +1 -1
  16. data/lib/json-rpc-objects/generic/response.rb +1 -1
  17. data/lib/json-rpc-objects/request.rb +4 -5
  18. data/lib/json-rpc-objects/response.rb +3 -4
  19. data/lib/json-rpc-objects/serializer.rb +1 -2
  20. data/lib/json-rpc-objects/serializer/marshal.rb +1 -1
  21. data/lib/json-rpc-objects/serializer/none.rb +1 -1
  22. data/lib/json-rpc-objects/utils.rb +6 -0
  23. data/lib/json-rpc-objects/utils/hash.rb +198 -0
  24. data/lib/json-rpc-objects/utils/object.rb +85 -0
  25. data/lib/json-rpc-objects/utils/string.rb +46 -0
  26. data/lib/json-rpc-objects/v10/error.rb +1 -1
  27. data/lib/json-rpc-objects/v10/request.rb +4 -5
  28. data/lib/json-rpc-objects/v10/response.rb +1 -1
  29. data/lib/json-rpc-objects/v10/tests/test.rb +1 -1
  30. data/lib/json-rpc-objects/v11/alt/error.rb +1 -1
  31. data/lib/json-rpc-objects/v11/alt/fakes/request.rb +1 -2
  32. data/lib/json-rpc-objects/v11/alt/fakes/response.rb +1 -2
  33. data/lib/json-rpc-objects/v11/alt/procedure-call.rb +4 -4
  34. data/lib/json-rpc-objects/v11/alt/procedure-parameter-description.rb +1 -1
  35. data/lib/json-rpc-objects/v11/alt/procedure-return.rb +2 -1
  36. data/lib/json-rpc-objects/v11/alt/request.rb +1 -1
  37. data/lib/json-rpc-objects/v11/alt/response.rb +1 -1
  38. data/lib/json-rpc-objects/v11/alt/service-description.rb +1 -1
  39. data/lib/json-rpc-objects/v11/alt/service-procedure-description.rb +2 -4
  40. data/lib/json-rpc-objects/v11/alt/tests/test.rb +1 -1
  41. data/lib/json-rpc-objects/v11/generic-types.rb +1 -1
  42. data/lib/json-rpc-objects/v11/wd/error.rb +5 -6
  43. data/lib/json-rpc-objects/v11/wd/extensions.rb +1 -1
  44. data/lib/json-rpc-objects/v11/wd/fakes/request.rb +1 -2
  45. data/lib/json-rpc-objects/v11/wd/fakes/response.rb +1 -2
  46. data/lib/json-rpc-objects/v11/wd/procedure-call.rb +13 -15
  47. data/lib/json-rpc-objects/v11/wd/procedure-parameter-description.rb +8 -8
  48. data/lib/json-rpc-objects/v11/wd/procedure-return.rb +4 -5
  49. data/lib/json-rpc-objects/v11/wd/request.rb +1 -1
  50. data/lib/json-rpc-objects/v11/wd/response.rb +1 -1
  51. data/lib/json-rpc-objects/v11/wd/service-description.rb +6 -8
  52. data/lib/json-rpc-objects/v11/wd/service-procedure-description.rb +8 -10
  53. data/lib/json-rpc-objects/v11/wd/tests/test.rb +1 -1
  54. data/lib/json-rpc-objects/v20/error.rb +6 -4
  55. data/lib/json-rpc-objects/v20/request.rb +6 -6
  56. data/lib/json-rpc-objects/v20/response.rb +2 -2
  57. data/lib/json-rpc-objects/v20/tests/test.rb +2 -2
  58. data/lib/json-rpc-objects/version.rb +18 -6
  59. data/spec/request_spec.rb +11 -0
  60. data/spec/spec_helper.rb +18 -0
  61. metadata +69 -51
@@ -1,8 +1,7 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/generic/request"
5
- require "hash-utils/object"
6
5
 
7
6
  ##
8
7
  # Main JSON-RPC Objects module.
@@ -134,7 +133,7 @@ module JsonRpcObjects
134
133
  #
135
134
 
136
135
  def __check_method
137
- if not (@method.symbol? or @method.string?)
136
+ if not (@method.kind_of? Symbol or @method.kind_of? String)
138
137
  raise Exception::new("Service name must be Symbol or convertable to Symbol.")
139
138
  end
140
139
  end
@@ -144,7 +143,7 @@ module JsonRpcObjects
144
143
  #
145
144
 
146
145
  def __check_params
147
- if not @params.array?
146
+ if not @params.kind_of? Array
148
147
  raise Exception::new("Params must be Array.")
149
148
  end
150
149
  end
@@ -154,7 +153,7 @@ module JsonRpcObjects
154
153
  #
155
154
 
156
155
  def __normalize_method
157
- if @method.string?
156
+ if @method.kind_of? String
158
157
  @method = @method.to_sym
159
158
  end
160
159
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/generic/response"
5
5
  require "json-rpc-objects/v10/error"
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  $:.push("../../..")
5
5
  #require "json-rpc-objects/serializer/marshal"
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/wd/error"
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/alt/procedure-call"
5
5
 
@@ -32,4 +32,3 @@ module JsonRpcObjects
32
32
  end
33
33
  end
34
34
  end
35
-
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/alt/procedure-return"
5
5
 
@@ -32,4 +32,3 @@ module JsonRpcObjects
32
32
  end
33
33
  end
34
34
  end
35
-
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
- require "hash-utils/hash"
5
4
  require "json-rpc-objects/v11/wd/request"
5
+ require "json-rpc-objects/utils"
6
6
 
7
7
  ##
8
8
  # Main JSON-RPC Objects module.
@@ -60,9 +60,9 @@ module JsonRpcObjects
60
60
  # property.
61
61
  if data.include? :kwparams
62
62
  @keyword_params = data[:kwparams]
63
- @keyword_params.keys_to_sym!
63
+ JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params
64
64
  end
65
- end
65
+ end
66
66
 
67
67
  ##
68
68
  # Assigns the parameters settings.
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/wd/procedure-parameter-description"
5
5
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
+ require "json-rpc-objects/utils"
4
5
  require "json-rpc-objects/v11/alt/error"
5
6
  require "json-rpc-objects/v11/wd/response"
6
7
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/alt/fakes/request"
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/alt/fakes/response"
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/alt/service-procedure-description"
5
5
  require "json-rpc-objects/v11/wd/service-description"
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
- require "hash-utils/array"
5
- require "hash-utils/object"
6
4
  require "json-rpc-objects/v11/alt/procedure-parameter-description"
7
5
  require "json-rpc-objects/v11/wd/service-procedure-description"
8
6
 
@@ -50,7 +48,7 @@ module JsonRpcObjects
50
48
  def check!
51
49
  super()
52
50
 
53
- if @params.array? and (not @params.all? { |v| v.type != JsonRpcObjects::V11::GenericTypes::Nil })
51
+ if @params.kind_of? Array and (not @params.all? { |v| v.type != JsonRpcObjects::V11::GenericTypes::Nil })
54
52
  raise Exception::new("Nil return type isn't allowed for parameters.")
55
53
  end
56
54
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  $:.push("../../../..")
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  ##
5
5
  # Main JSON-RPC Objects module.
@@ -1,8 +1,7 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
- require "hash-utils/numeric"
5
- require "hash-utils/hash"
4
+ require "json-rpc-objects/utils"
6
5
  require "json-rpc-objects/generic"
7
6
  require "json-rpc-objects/v10/error"
8
7
  require "json-rpc-objects/v11/wd/extensions"
@@ -103,8 +102,8 @@ module JsonRpcObjects
103
102
  def check!
104
103
  self.normalize!
105
104
 
106
- if not @code.in? 100..999
107
- raise Exception::new("Code must be between 100 and 999 including them.")
105
+ if not (100..999).include? @code
106
+ raise JsonRpcObjects::Exceptions::InvalidCode::new("Code must be between 100 and 999 including them.")
108
107
  end
109
108
  end
110
109
 
@@ -125,7 +124,7 @@ module JsonRpcObjects
125
124
  data["error"] = @data
126
125
  end
127
126
 
128
- data.merge! @extensions.map_keys { |k| k.to_s }
127
+ data.merge! JsonRpcObjects::Utils::Hash.map_keys(@extensions) { |k| k.to_s }
129
128
  return data
130
129
  end
131
130
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  ##
5
5
  # Main JSON-RPC Objects module.
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/wd/procedure-call"
5
5
 
@@ -32,4 +32,3 @@ module JsonRpcObjects
32
32
  end
33
33
  end
34
34
  end
35
-
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/wd/procedure-return"
5
5
 
@@ -32,4 +32,3 @@ module JsonRpcObjects
32
32
  end
33
33
  end
34
34
  end
35
-
@@ -1,10 +1,7 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
- require "hash-utils/array"
5
- require "hash-utils/hash"
6
- require "hash-utils/object"
7
- require "hash-utils/string"
4
+ require "json-rpc-objects/utils"
8
5
  require "json-rpc-objects/v10/request"
9
6
  require "json-rpc-objects/v11/wd/extensions"
10
7
 
@@ -32,7 +29,6 @@ module JsonRpcObjects
32
29
  #
33
30
 
34
31
  class ProcedureCall < JsonRpcObjects::V10::Request
35
-
36
32
  include Extensions
37
33
 
38
34
  ##
@@ -68,7 +64,7 @@ module JsonRpcObjects
68
64
  def check!
69
65
  super()
70
66
 
71
- if not @keyword_params.nil? and not @keyword_params.hash?
67
+ if not @keyword_params.nil? and not @keyword_params.kind_of? Hash
72
68
  raise Exception::new("Keyword params must be Hash.")
73
69
  end
74
70
  end
@@ -99,7 +95,7 @@ module JsonRpcObjects
99
95
  end
100
96
 
101
97
  data.merge! @extensions
102
- return data.map_keys! { |k| k.to_s }
98
+ return JsonRpcObjects::Utils::Hash.map_keys!(data) { |k| k.to_s }
103
99
  end
104
100
 
105
101
 
@@ -147,15 +143,18 @@ module JsonRpcObjects
147
143
  # If named arguments used, assigns keys as symbols
148
144
  # but keeps numeric arguments as integers
149
145
 
150
- if @params.hash?
146
+ if @params.kind_of? Hash
151
147
  @params = @params.dup
152
- @keyword_params = @params.remove! { |k, v| not k.numeric? }
153
- @params = @params.sort_by { |i| i.first.to_i }.map { |i| i.second }
148
+ @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|
149
+ not JsonRpcObjects::Utils::String.numeric? k
150
+ end
151
+
152
+ @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }
154
153
  else
155
154
  @keyword_params = { }
156
155
  end
157
156
 
158
- @keyword_params.keys_to_sym!
157
+ JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params
159
158
 
160
159
  end
161
160
 
@@ -175,7 +174,7 @@ module JsonRpcObjects
175
174
  params.merge! @keyword_params
176
175
  end
177
176
 
178
- data[:params] = params.map_keys! { |k| k.to_s }
177
+ data[:params] = Utils::Hash.map_keys!(params) { |k| k.to_s }
179
178
  end
180
179
 
181
180
  ##
@@ -183,7 +182,7 @@ module JsonRpcObjects
183
182
  #
184
183
 
185
184
  def __check_params
186
- if not @params.nil? and not @params.array?
185
+ if not @params.nil? and not @params.kind_of? Array
187
186
  raise Exception::new("Params must be Array.")
188
187
  end
189
188
  end
@@ -208,4 +207,3 @@ module JsonRpcObjects
208
207
  end
209
208
  end
210
209
  end
211
-
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/generic-types"
5
5
  require "json-rpc-objects/generic"
6
- require "hash-utils/object"
6
+ require "json-rpc-objects/utils"
7
7
 
8
8
  ##
9
9
  # Main JSON-RPC Objects module.
@@ -40,7 +40,7 @@ module JsonRpcObjects
40
40
  # Maps type to object (class).
41
41
  #
42
42
 
43
- TYPE_TO_OBJECT = Hash::define({
43
+ TYPE_TO_OBJECT = Utils::Hash::define({
44
44
  :num => Integer,
45
45
  :str => String,
46
46
  :arr => Array,
@@ -54,7 +54,7 @@ module JsonRpcObjects
54
54
  # Maps object (class) to type.
55
55
  #
56
56
 
57
- OBJECT_TO_TYPE = Hash::define({
57
+ OBJECT_TO_TYPE = Utils::Hash::define({
58
58
  Integer => :num,
59
59
  String => :str,
60
60
  Array => :arr,
@@ -100,11 +100,11 @@ module JsonRpcObjects
100
100
  def check!
101
101
  self.normalize!
102
102
 
103
- if not @name.symbol?
103
+ if not @name.kind_of? Symbol
104
104
  raise Exception::new("Parameter name must be Symbol or convertable to Symbol.")
105
105
  end
106
106
 
107
- if (not @type.nil?) and (not @type.kind_of_any? [GenericTypes::Any, GenericTypes::Nil, GenericTypes::Boolean, Integer, String, Array, Object])
107
+ if (not @type.nil?) and (not Utils::Object.kind_of_any?(@type, [GenericTypes::Any, GenericTypes::Nil, GenericTypes::Boolean, Integer, String, Array, Object]))
108
108
  raise Exception::new("Type if defined can be only Any, Nil, Boolean, Integer, String, Array or Object.")
109
109
  end
110
110
  end
@@ -144,11 +144,11 @@ module JsonRpcObjects
144
144
  #
145
145
 
146
146
  def normalize!
147
- if @name.string?
147
+ if @name.kind_of? String
148
148
  @name = @name.to_sym
149
149
  end
150
150
 
151
- if @type.kind_of_any? [String, Symbol]
151
+ if Utils::Object.kind_of_any?(@type, [String, Symbol])
152
152
  @type = __normalize_type
153
153
  end
154
154
  end
@@ -1,11 +1,10 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
+ require "json-rpc-objects/utils"
4
5
  require "json-rpc-objects/v10/response"
5
6
  require "json-rpc-objects/v11/wd/error"
6
7
  require "json-rpc-objects/v11/wd/extensions"
7
- require "hash-utils/object"
8
- require "hash-utils/hash"
9
8
 
10
9
  ##
11
10
  # Main JSON-RPC Objects module.
@@ -92,7 +91,7 @@ module JsonRpcObjects
92
91
  data["id"] = @id
93
92
  end
94
93
 
95
- data.merge! @extensions.map_keys { |k| k.to_s }
94
+ data.merge! Utils::Hash.map_keys(@extensions) { |k| k.to_s }
96
95
  return data
97
96
  end
98
97
 
@@ -132,7 +131,7 @@ module JsonRpcObjects
132
131
  #
133
132
 
134
133
  def __create_error
135
- if @error.hash?
134
+ if @error.kind_of? Hash
136
135
  @error = self.class::ERROR_CLASS::new(@error)
137
136
  end
138
137
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/wd/fakes/request"
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "json-rpc-objects/v11/wd/fakes/response"
@@ -1,11 +1,9 @@
1
1
  # encoding: utf-8
2
- # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
2
+ # (c) 2011-2015 Martin Poljak (martin@poljak.cz)
3
3
 
4
4
  require "addressable/uri"
5
5
  require "json-rpc-objects/v11/wd/service-procedure-description"
6
6
  require "json-rpc-objects/generic"
7
- require "hash-utils/array"
8
- require "hash-utils/object"
9
7
 
10
8
  ##
11
9
  # Main JSON-RPC Objects module.
@@ -133,7 +131,7 @@ module JsonRpcObjects
133
131
  def check!
134
132
  self.normalize!
135
133
 
136
- if not @name.symbol?
134
+ if not @name.kind_of? Symbol
137
135
  raise Exception::new("Service name must be Symbol or convertable to Symbol.")
138
136
  end
139
137
 
@@ -142,11 +140,11 @@ module JsonRpcObjects
142
140
  end
143
141
 
144
142
  if (not @procs.nil?)
145
- if (not @procs.array?) or (not @procs.all? { |v| v.kind_of? self.class::PROCEDURE_DESCRIPTION_CLASS })
143
+ if (not @procs.kind_of? Array) or (not @procs.all? { |v| v.kind_of? self.class::PROCEDURE_DESCRIPTION_CLASS })
146
144
  raise Exception::new("If procs is defined, must be an Array of " << self.class::PROCEDURE_DESCRIPTION_CLASS.name << " objects.")
147
145
  end
148
146
 
149
- if @procs.array?
147
+ if @procs.kind_of? Array
150
148
  @procs.each { |proc| proc.check! }
151
149
  end
152
150
  end
@@ -225,7 +223,7 @@ module JsonRpcObjects
225
223
  @address = data[:address]
226
224
  @procs = data[:procs]
227
225
 
228
- if @procs.array?
226
+ if @procs.kind_of? Array
229
227
  @procs = @procs.map { |v| self.class::PROCEDURE_DESCRIPTION_CLASS::new(v) }
230
228
  end
231
229
  end
@@ -235,7 +233,7 @@ module JsonRpcObjects
235
233
  #
236
234
 
237
235
  def normalize!
238
- if @name.string?
236
+ if @name.kind_of? String
239
237
  @name = @name.to_sym
240
238
  end
241
239