Skip to content

Commit bb18fd4

Browse files
committed
Remove ActiveSupport dependency
1 parent 4fedc23 commit bb18fd4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/line/bot/client.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
require 'base64'
1818
require 'net/http'
1919
require 'openssl'
20-
require 'active_support/core_ext/string/inflections'
2120

2221
module Line
2322
module Bot
@@ -419,7 +418,7 @@ def parse_events_from(request_body)
419418

420419
json['events'].map { |item|
421420
begin
422-
klass = Line::Bot::Event.const_get(item['type'].camelize)
421+
klass = Line::Bot::Event.const_get(camelize(item['type']))
423422
klass.new(item)
424423
rescue NameError => e
425424
Line::Bot::Event::Base.new(item)
@@ -463,6 +462,11 @@ def secure_compare(a, b)
463462
b.each_byte { |byte| res |= byte ^ l.shift }
464463
res == 0
465464
end
465+
466+
# @return [String]
467+
def camelize(string)
468+
string.split(/_|(?=[A-Z])/).map(&:capitalize).join
469+
end
466470
end
467471
end
468472
end

line-bot-api.gemspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ Gem::Specification.new do |spec|
1919

2020
spec.required_ruby_version = '>= 2.0.0'
2121

22-
spec.add_runtime_dependency "activesupport"
23-
2422
spec.add_development_dependency "addressable", "~> 2.3"
2523
spec.add_development_dependency "bundler", "~> 1.11"
2624
spec.add_development_dependency 'rake', "~> 10.4"

0 commit comments

Comments
 (0)