Sha256: de81069336cd3b37806271dbf0cf0bc08eaf6d7e561966e4b936343ac077e8d2

Contents?: true

Size: 917 Bytes

Versions: 2

Compression:

Stored size: 917 Bytes

Contents

# Copyright 2017 Stratumn SAS. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module AgentClient
  # We would like to avoid depending on ActiveSupport
  module Helper
    def underscore(string)
      word = string.to_s.dup
      word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
      word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
      word.tr!('-', '_')
      word.downcase!
      word
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
indigoframework_agent_client-0.2.0 lib/agent_client/helper.rb
stratumn_agent_client-1.0.1 lib/agent_client/helper.rb