mirror of
https://github.com/onyx-and-iris/obsws-ruby.git
synced 2026-04-19 05:53:33 +00:00
initial commit
This commit is contained in:
16
lib/obsws/util.rb
Normal file
16
lib/obsws/util.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
module OBSWS
|
||||
module Util
|
||||
class ::String
|
||||
def to_camel
|
||||
self.split(/_/).map(&:capitalize).join
|
||||
end
|
||||
|
||||
def to_snake
|
||||
self
|
||||
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
||||
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
||||
.downcase
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user