module Raml::Parser::Util

Private Instance Methods

prepare_attributes(attributes) click to toggle source
# File lib/raml/parser/util.rb, line 7
def prepare_attributes(attributes)
  hash = {}
  attributes.each do |key, value|
    hash[underscore(key)] = value
  end if attributes.respond_to?(:each)
  hash
end
underscore(string) click to toggle source
# File lib/raml/parser/util.rb, line 15
def underscore(string)
  string.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
    .gsub(/([a-z\d])([A-Z])/,'\1_\2')
    .downcase
end