File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 17
17
require 'base64'
18
18
require 'net/http'
19
19
require 'openssl'
20
- require 'active_support/core_ext/string/inflections'
21
20
22
21
module Line
23
22
module Bot
@@ -419,7 +418,7 @@ def parse_events_from(request_body)
419
418
420
419
json [ 'events' ] . map { |item |
421
420
begin
422
- klass = Line ::Bot ::Event . const_get ( item [ 'type' ] . camelize )
421
+ klass = Line ::Bot ::Event . const_get ( camelize ( item [ 'type' ] ) )
423
422
klass . new ( item )
424
423
rescue NameError => e
425
424
Line ::Bot ::Event ::Base . new ( item )
@@ -463,6 +462,11 @@ def secure_compare(a, b)
463
462
b . each_byte { |byte | res |= byte ^ l . shift }
464
463
res == 0
465
464
end
465
+
466
+ # @return [String]
467
+ def camelize ( string )
468
+ string . split ( /_|(?=[A-Z])/ ) . map ( &:capitalize ) . join
469
+ end
466
470
end
467
471
end
468
472
end
Original file line number Diff line number Diff line change @@ -19,8 +19,6 @@ Gem::Specification.new do |spec|
19
19
20
20
spec . required_ruby_version = '>= 2.0.0'
21
21
22
- spec . add_runtime_dependency "activesupport"
23
-
24
22
spec . add_development_dependency "addressable" , "~> 2.3"
25
23
spec . add_development_dependency "bundler" , "~> 1.11"
26
24
spec . add_development_dependency 'rake' , "~> 10.4"
You can’t perform that action at this time.
0 commit comments