aquarium 0.7.1 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +6 -0
- data/UPGRADE +4 -0
- data/aquarium.gemspec +0 -1
- data/lib/aquarium/aspects/advice.rb +43 -41
- data/lib/aquarium/extensions.rb +0 -1
- data/lib/aquarium/utils.rb +1 -0
- data/lib/aquarium/utils/camel_case.rb +18 -0
- data/lib/aquarium/version.rb +1 -1
- data/spec/aquarium/utils/camel_case_spec.rb +52 -0
- metadata +7 -7
- data/lib/aquarium/extensions/string.rb +0 -13
- data/spec/aquarium/extensions/string_spec.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df94cd118d921250a4c653a487c04b8446c311b8901f2fffe0dfb047a66b89f7
|
4
|
+
data.tar.gz: 6822873aecf444624668cbba457e5dad45b243b6d86d7b22f9a73f664fb3ce3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1244c4a7b426bdca859e6670323ad5320f078dab7616202aeb1a3a07743825af11f301757049df29339b55f37cada3b5024072ef5a3e4c4532e6b6071681318e
|
7
|
+
data.tar.gz: 73eac1c747752f01250cf22ea4401601da5b65880caac5b53b919cbd7d3e385e36c829f15debf07cba7d7f68c8f4d256f520667b0f7eb5672bc840390e1b3bd9
|
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== Version 0.7.3
|
2
|
+
|
3
|
+
(0.7.2 had documentation errors.)
|
4
|
+
|
5
|
+
Removed an ill-advised (if you'll pardon the expression...) use of monkey patching to add a `to_camel_case` method to `String`, which I only used in one place! Instead, I just call a utility to do this.
|
6
|
+
|
1
7
|
== Version 0.7.1
|
2
8
|
|
3
9
|
Adds support for Ruby 2.6. It was tested with 2.6.3p62 (2019-04-16 revision 67580). Basic JRuby 9.2.7.0 (2.5.3) 2019-04-09 8a269e3 support is provided, but using JRuby currently does *not* pass all the custom Java specs in the `jruby/spec` directory, which specifically test working with Java classes. However, JRuby does pass all the Ruby specs in the `spec` directory. This is a long-standing issue with JRuby support in Aquarium. Patches are welcome!
|
data/UPGRADE
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== Updating to Aquarium-0.7.3
|
2
|
+
|
3
|
+
Version 0.7.3 has only been tested with Ruby 2.7.0, but it should support the same versions as version 0.7.1, as this release contains only a relatively small set of code changes to fix issue #43.
|
4
|
+
|
1
5
|
== Updating to Aquarium-0.7.1
|
2
6
|
|
3
7
|
Version 0.7.1 supports only Ruby 2.6. It was tested with 2.6.3p62 (2019-04-16 revision 67580). Basic JRuby 9.2.7.0 (2.5.3) 2019-04-09 8a269e3 support is provided, but using JRuby currently does *not* pass all the custom Java specs in the `jruby/spec` directory, which specifically test working with Java classes. However, JRuby does pass all the Ruby specs in the `spec` directory. This is a long-standing issue with JRuby support in Aquarium. Patches are welcome!
|
data/aquarium.gemspec
CHANGED
@@ -12,7 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.authors = ["Dean Wampler and other contributors"]
|
13
13
|
s.email = "deanwampler@gmail.com"
|
14
14
|
s.homepage = "https://deanwampler.github.io/open-source/aquarium/index.html"
|
15
|
-
s.rubyforge_project = "aquarium"
|
16
15
|
s.description = <<-EOF
|
17
16
|
Aquarium is a full-featured Aspect-Oriented Programming (AOP) framework for Ruby that is
|
18
17
|
designed to provide an intuitive syntax and support for large-scale, dynamic aspects.
|
@@ -1,29 +1,31 @@
|
|
1
1
|
require 'aquarium/utils/array_utils'
|
2
|
-
require 'aquarium/
|
2
|
+
require 'aquarium/utils/camel_case'
|
3
3
|
require 'aquarium/utils/invalid_options'
|
4
4
|
require 'aquarium/utils/nil_object'
|
5
5
|
|
6
|
+
include Aquarium::Utils::CamelCase
|
7
|
+
|
6
8
|
module Aquarium
|
7
9
|
module Aspects
|
8
10
|
module Advice
|
9
|
-
|
11
|
+
|
10
12
|
UNKNOWN_ADVICE_KIND = "unknown"
|
11
13
|
|
12
|
-
KINDS_IN_PRIORITY_ORDER = [:around, :before, :after, :after_returning, :after_raising]
|
14
|
+
KINDS_IN_PRIORITY_ORDER = [:around, :before, :after, :after_returning, :after_raising]
|
13
15
|
|
14
16
|
@DEBUG_BACKTRACES = false
|
15
17
|
|
16
18
|
def self.debug_backtraces; @DEBUG_BACKTRACES; end
|
17
19
|
def self.debug_backtraces=( val ); @DEBUG_BACKTRACES = val; end
|
18
|
-
|
20
|
+
|
19
21
|
def self.kinds; KINDS_IN_PRIORITY_ORDER; end
|
20
22
|
|
21
23
|
def self.sort_by_priority_order advice_kinds
|
22
|
-
advice_kinds.sort do |x,y|
|
24
|
+
advice_kinds.sort do |x,y|
|
23
25
|
KINDS_IN_PRIORITY_ORDER.index(x.to_sym) <=> KINDS_IN_PRIORITY_ORDER.index(y.to_sym)
|
24
26
|
end.map {|x| x.to_sym}
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
def self.compare_advice_kinds kind1, kind2
|
28
30
|
if kind1.nil?
|
29
31
|
return kind2.nil? ? 0 : -1
|
@@ -35,18 +37,18 @@ module Aquarium
|
|
35
37
|
return kind2.eql?(UNKNOWN_ADVICE_KIND) ? 1 : KINDS_IN_PRIORITY_ORDER.index(kind1) <=> KINDS_IN_PRIORITY_ORDER.index(kind2)
|
36
38
|
end
|
37
39
|
end
|
38
|
-
|
39
|
-
end
|
40
|
+
|
41
|
+
end
|
40
42
|
|
41
43
|
# Supports Enumerable, but not the sorting methods, as this class is a linked list structure.
|
42
44
|
# This is of limited usefulness, because you wouldn't use an iterator to invoke the procs
|
43
45
|
# in the chain, because each proc will invoke the next node arbitrarily or possibly not at all
|
44
46
|
# in the case of around advice!
|
45
|
-
class AdviceChainNode
|
47
|
+
class AdviceChainNode
|
46
48
|
include Enumerable
|
47
49
|
def initialize options = {}
|
48
50
|
# assign :next_node and :static_join_point so the attributes are always created
|
49
|
-
options[:next_node] ||= nil
|
51
|
+
options[:next_node] ||= nil
|
50
52
|
options[:static_join_point] ||= nil
|
51
53
|
options.each do |key, value|
|
52
54
|
instance_variable_set "@#{key}".intern, value
|
@@ -55,7 +57,7 @@ module Aquarium
|
|
55
57
|
EOF
|
56
58
|
end
|
57
59
|
end
|
58
|
-
|
60
|
+
|
59
61
|
# Bug #19262 workaround: need to only pass jp argument if arity is 1.
|
60
62
|
def call_advice jp
|
61
63
|
if advice.arity == 1
|
@@ -64,7 +66,7 @@ module Aquarium
|
|
64
66
|
advice.call jp, jp.context.advised_object, *jp.context.parameters
|
65
67
|
end
|
66
68
|
end
|
67
|
-
|
69
|
+
|
68
70
|
def call jp
|
69
71
|
begin
|
70
72
|
advice_wrapper jp
|
@@ -72,7 +74,7 @@ module Aquarium
|
|
72
74
|
handle_call_rescue e, "", jp
|
73
75
|
end
|
74
76
|
end
|
75
|
-
|
77
|
+
|
76
78
|
def invoke_original_join_point current_jp
|
77
79
|
begin
|
78
80
|
last.advice_wrapper current_jp
|
@@ -80,41 +82,41 @@ module Aquarium
|
|
80
82
|
handle_call_rescue e, "While executing the original join_point: ", current_jp
|
81
83
|
end
|
82
84
|
end
|
83
|
-
|
85
|
+
|
84
86
|
# Supports Enumerable
|
85
|
-
def each
|
86
|
-
node = self
|
87
|
-
while node.nil? == false
|
88
|
-
yield node
|
89
|
-
node = node.next_node
|
90
|
-
end
|
87
|
+
def each
|
88
|
+
node = self
|
89
|
+
while node.nil? == false
|
90
|
+
yield node
|
91
|
+
node = node.next_node
|
92
|
+
end
|
91
93
|
end
|
92
|
-
|
94
|
+
|
93
95
|
def last
|
94
96
|
last_node = nil
|
95
|
-
each { |node| last_node = node unless node.nil? }
|
97
|
+
each { |node| last_node = node unless node.nil? }
|
96
98
|
last_node
|
97
99
|
end
|
98
|
-
|
100
|
+
|
99
101
|
def size
|
100
102
|
inject(0) {|memo, node| memo += 1}
|
101
103
|
end
|
102
|
-
|
104
|
+
|
103
105
|
def empty?
|
104
106
|
next_node.nil?
|
105
107
|
end
|
106
|
-
|
108
|
+
|
107
109
|
# TODO: remove this method, which causes run-away recursions in R1.9.1
|
108
110
|
# def inspect &block
|
109
|
-
# block ? yield(self) : super
|
111
|
+
# block ? yield(self) : super
|
110
112
|
# end
|
111
|
-
|
113
|
+
|
112
114
|
NIL_OBJECT = Aquarium::Utils::NilObject.new
|
113
|
-
|
115
|
+
|
114
116
|
protected
|
115
|
-
|
117
|
+
|
116
118
|
#--
|
117
|
-
# For performance reasons, we don't clone the context.
|
119
|
+
# For performance reasons, we don't clone the context.
|
118
120
|
# TODO: There are potential concurrency issues!
|
119
121
|
#++
|
120
122
|
def update_current_context jp
|
@@ -124,12 +126,12 @@ module Aquarium
|
|
124
126
|
jp.context.current_advice_node = self
|
125
127
|
end
|
126
128
|
|
127
|
-
def reset_current_context jp
|
129
|
+
def reset_current_context jp
|
128
130
|
return if advice.arity == 0
|
129
131
|
jp.context.advice_kind = @last_advice_kind
|
130
132
|
jp.context.current_advice_node = @last_advice_node
|
131
133
|
end
|
132
|
-
|
134
|
+
|
133
135
|
def handle_call_rescue ex, error_message_prefix, jp
|
134
136
|
if Aquarium::Aspects::Advice.debug_backtraces
|
135
137
|
class_or_instance_method_separater = jp.instance_method? ? "#" : "."
|
@@ -154,7 +156,7 @@ module Aquarium
|
|
154
156
|
# rather than object.method(...).call(*args). The latter fails when the original method
|
155
157
|
# calls super. This is a Ruby bug: http://www.ruby-forum.com/topic/124276
|
156
158
|
class NoAdviceChainNode < AdviceChainNode
|
157
|
-
# Note that we extract the block passed to the original method call, if any,
|
159
|
+
# Note that we extract the block passed to the original method call, if any,
|
158
160
|
# from the context and pass it to method invocation.
|
159
161
|
def initialize options = {}
|
160
162
|
super options
|
@@ -166,7 +168,7 @@ module Aquarium
|
|
166
168
|
|
167
169
|
class BeforeAdviceChainNode < AdviceChainNode
|
168
170
|
def initialize options = {}
|
169
|
-
super options
|
171
|
+
super options
|
170
172
|
end
|
171
173
|
def advice_wrapper jp
|
172
174
|
update_current_context jp
|
@@ -220,11 +222,11 @@ module Aquarium
|
|
220
222
|
def after_raising_exceptions_list_includes raised_exception
|
221
223
|
after_raising_exceptions_list.find {|x| raised_exception.kind_of? x}
|
222
224
|
end
|
223
|
-
|
224
|
-
def after_raising_exceptions_list
|
225
|
+
|
226
|
+
def after_raising_exceptions_list
|
225
227
|
list = @after_raising.kind_of?(Set) ? @after_raising.to_a : @after_raising
|
226
228
|
(list.nil? || list.empty? || (list.size == 1 && list[0] == "")) ? [Object] : list
|
227
|
-
end
|
229
|
+
end
|
228
230
|
end
|
229
231
|
|
230
232
|
class AfterAdviceChainNode < AdviceChainNode
|
@@ -232,7 +234,7 @@ module Aquarium
|
|
232
234
|
super options
|
233
235
|
end
|
234
236
|
def advice_wrapper jp
|
235
|
-
# call_advice is invoked in each bloc, rather than once in an "ensure" clause, so the invocation in
|
237
|
+
# call_advice is invoked in each bloc, rather than once in an "ensure" clause, so the invocation in
|
236
238
|
# the rescue clause can allow the advice to change the exception that will be raised.
|
237
239
|
begin
|
238
240
|
returned_value = next_node.call jp
|
@@ -270,18 +272,18 @@ module Aquarium
|
|
270
272
|
end
|
271
273
|
|
272
274
|
# The advice_kind argument must be one of the values returned by Advice.kinds or one of the special values
|
273
|
-
# ":no" or ":none", signfying a node for which there is no advice, where the actual method being advised is
|
275
|
+
# ":no" or ":none", signfying a node for which there is no advice, where the actual method being advised is
|
274
276
|
# called directly instead. This kind of node is normally used as the terminal leaf in the chain.
|
275
277
|
module AdviceChainNodeFactory
|
276
278
|
def self.make_node options = {}
|
277
279
|
advice_kind = options[:advice_kind]
|
278
280
|
raise Aquarium::Utils::InvalidOptions.new("Unknown advice kind specified: #{advice_kind}") unless valid(advice_kind)
|
279
281
|
advice_kind = :no if advice_kind == :none
|
280
|
-
advice_chain_node_name = advice_kind.to_s
|
282
|
+
advice_chain_node_name = Aquarium::Utils::CamelCase.to_camel_case(advice_kind.to_s) + "AdviceChainNode"
|
281
283
|
clazz = Aquarium::Aspects.const_get advice_chain_node_name
|
282
284
|
clazz.new options
|
283
285
|
end
|
284
|
-
|
286
|
+
|
285
287
|
def self.valid advice_kind
|
286
288
|
advice_kind == :no || advice_kind == :none || Advice.kinds.include?(advice_kind)
|
287
289
|
end
|
data/lib/aquarium/extensions.rb
CHANGED
data/lib/aquarium/utils.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Aquarium
|
2
|
+
module Utils
|
3
|
+
module CamelCase
|
4
|
+
def to_camel_case str
|
5
|
+
str.split('_').map {|s| s[0,1]=s[0,1].capitalize; s}.join
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_snake_case str
|
9
|
+
str.gsub(/([A-Z]+[a-z0-9_-]*)/, '\1_').downcase.gsub(/__*/, '_').gsub(/_$/, '').gsub(/^_/, '')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# bad id, as at least one other library wants to define from on string
|
16
|
+
# class String
|
17
|
+
# include Aquarium::Extensions::CamelCase
|
18
|
+
# end
|
data/lib/aquarium/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require 'aquarium/utils/camel_case'
|
3
|
+
|
4
|
+
describe CamelCase, "#to_camel_case" do
|
5
|
+
it "should return a camel-case string unchanged" do
|
6
|
+
CamelCase.to_camel_case("CamelCaseString").should == "CamelCaseString"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should return a camel-case string from an input string with substrings separated by underscores" do
|
10
|
+
CamelCase.to_camel_case("camel_case_string").should == "CamelCaseString"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should return a camel-case string with the first letters of each substring in uppercase and the rest of the letters in each substring unchanged" do
|
14
|
+
CamelCase.to_camel_case("cAmEl_cASE_stRinG").should == "CAmElCASEStRinG"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should remove leading and trailing underscores" do
|
18
|
+
CamelCase.to_camel_case("camel_case_string_").should == "CamelCaseString"
|
19
|
+
CamelCase.to_camel_case("_camel_case_string").should == "CamelCaseString"
|
20
|
+
CamelCase.to_camel_case("camel_case_string__").should == "CamelCaseString"
|
21
|
+
CamelCase.to_camel_case("__camel_case_string").should == "CamelCaseString"
|
22
|
+
CamelCase.to_camel_case("_camel_case_string_").should == "CamelCaseString"
|
23
|
+
CamelCase.to_camel_case("__camel_case_string__").should == "CamelCaseString"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe CamelCase, "#to_snake_case" do
|
28
|
+
it "should return a snake-case string unchanged" do
|
29
|
+
CamelCase.to_snake_case("camel_case_string").should == "camel_case_string"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return a snake-case string to an input string with substrings separated by underscores" do
|
33
|
+
CamelCase.to_snake_case("CamelCaseString").should == "camel_case_string"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return a snake-case string with all characters converted to lower case" do
|
37
|
+
CamelCase.to_snake_case("CamelCaseString").should == "camel_case_string"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should partition the words by [A-Z]+[a-z0-9]*" do
|
41
|
+
CamelCase.to_snake_case("CAmElCASEStRinG").should == "cam_el_casest_rin_g"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should preserve embedded underscores" do
|
45
|
+
CamelCase.to_snake_case("C_Am_ElCA_SEStR_inG").should == "c_am_el_ca_sest_r_in_g"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should remove leading, trailing, and repeated underscores" do
|
49
|
+
puts CamelCase.to_snake_case("_Camel__CaseString_")
|
50
|
+
CamelCase.to_snake_case("_Camel__CaseString_").should == "camel_case_string"
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aquarium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Wampler and other contributors
|
8
8
|
autorequire: aquarium
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -205,7 +205,6 @@ files:
|
|
205
205
|
- lib/aquarium/extensions/hash.rb
|
206
206
|
- lib/aquarium/extensions/regexp.rb
|
207
207
|
- lib/aquarium/extensions/set.rb
|
208
|
-
- lib/aquarium/extensions/string.rb
|
209
208
|
- lib/aquarium/extras.rb
|
210
209
|
- lib/aquarium/extras/design_by_contract.rb
|
211
210
|
- lib/aquarium/finders.rb
|
@@ -215,6 +214,7 @@ files:
|
|
215
214
|
- lib/aquarium/finders/type_finder.rb
|
216
215
|
- lib/aquarium/utils.rb
|
217
216
|
- lib/aquarium/utils/array_utils.rb
|
217
|
+
- lib/aquarium/utils/camel_case.rb
|
218
218
|
- lib/aquarium/utils/default_logger.rb
|
219
219
|
- lib/aquarium/utils/hash_utils.rb
|
220
220
|
- lib/aquarium/utils/html_escaper.rb
|
@@ -251,7 +251,6 @@ files:
|
|
251
251
|
- spec/aquarium/extensions/hash_spec.rb
|
252
252
|
- spec/aquarium/extensions/regex_spec.rb
|
253
253
|
- spec/aquarium/extensions/set_spec.rb
|
254
|
-
- spec/aquarium/extensions/string_spec.rb
|
255
254
|
- spec/aquarium/extras/design_by_contract_spec.rb
|
256
255
|
- spec/aquarium/finders/finder_result_spec.rb
|
257
256
|
- spec/aquarium/finders/method_finder_spec.rb
|
@@ -263,6 +262,7 @@ files:
|
|
263
262
|
- spec/aquarium/spec_example_types.rb
|
264
263
|
- spec/aquarium/spec_helper.rb
|
265
264
|
- spec/aquarium/utils/array_utils_spec.rb
|
265
|
+
- spec/aquarium/utils/camel_case_spec.rb
|
266
266
|
- spec/aquarium/utils/default_logger_spec.rb
|
267
267
|
- spec/aquarium/utils/hash_utils_spec.rb
|
268
268
|
- spec/aquarium/utils/html_escaper_spec.rb
|
@@ -293,10 +293,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: '0'
|
295
295
|
requirements: []
|
296
|
-
rubygems_version: 3.
|
296
|
+
rubygems_version: 3.1.2
|
297
297
|
signing_key:
|
298
298
|
specification_version: 4
|
299
|
-
summary: Aquarium-0.7.
|
299
|
+
summary: Aquarium-0.7.3 (r7) - Aspect-Oriented Programming toolkit for Ruby http://aquarium.rubyforge.org
|
300
300
|
test_files:
|
301
301
|
- spec/aquarium/aspects/advice_chain_node_spec.rb
|
302
302
|
- spec/aquarium/aspects/advice_spec.rb
|
@@ -316,7 +316,6 @@ test_files:
|
|
316
316
|
- spec/aquarium/extensions/hash_spec.rb
|
317
317
|
- spec/aquarium/extensions/regex_spec.rb
|
318
318
|
- spec/aquarium/extensions/set_spec.rb
|
319
|
-
- spec/aquarium/extensions/string_spec.rb
|
320
319
|
- spec/aquarium/extras/design_by_contract_spec.rb
|
321
320
|
- spec/aquarium/finders/finder_result_spec.rb
|
322
321
|
- spec/aquarium/finders/method_finder_spec.rb
|
@@ -328,6 +327,7 @@ test_files:
|
|
328
327
|
- spec/aquarium/spec_example_types.rb
|
329
328
|
- spec/aquarium/spec_helper.rb
|
330
329
|
- spec/aquarium/utils/array_utils_spec.rb
|
330
|
+
- spec/aquarium/utils/camel_case_spec.rb
|
331
331
|
- spec/aquarium/utils/default_logger_spec.rb
|
332
332
|
- spec/aquarium/utils/hash_utils_spec.rb
|
333
333
|
- spec/aquarium/utils/html_escaper_spec.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
require 'aquarium/extensions/string'
|
3
|
-
|
4
|
-
describe String, "#to_camel_case" do
|
5
|
-
it "should return a camel-case string unchanged" do
|
6
|
-
"CamelCaseString".to_camel_case.should == "CamelCaseString"
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should return a camel-case string from an input string with substrings separated by underscores" do
|
10
|
-
"camel_case_string".to_camel_case.should == "CamelCaseString"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should return a camel-case string with the first letters of each substring in uppercase and the rest of the letters in each substring unchanged" do
|
14
|
-
"cAmEl_cASE_stRinG".to_camel_case.should == "CAmElCASEStRinG"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should remove leading and trailing underscores" do
|
18
|
-
"camel_case_string_".to_camel_case.should == "CamelCaseString"
|
19
|
-
"_camel_case_string".to_camel_case.should == "CamelCaseString"
|
20
|
-
"camel_case_string__".to_camel_case.should == "CamelCaseString"
|
21
|
-
"__camel_case_string".to_camel_case.should == "CamelCaseString"
|
22
|
-
"_camel_case_string_".to_camel_case.should == "CamelCaseString"
|
23
|
-
"__camel_case_string__".to_camel_case.should == "CamelCaseString"
|
24
|
-
end
|
25
|
-
end
|