class GraphQL::Upgrader::UnderscoreizeFieldNameTransform

Take camelized field names and convert them to underscore case. (They'll be automatically camelized later.)

Public Instance Methods

apply(input_text) click to toggle source
# File lib/graphql/upgrader/member.rb, line 262
def apply(input_text)
  input_text.gsub /(?<field_type>input_field|return_field|field|connection|argument) :(?<name>[a-zA-Z_0-9_]*)/ do
    field_type = $~[:field_type]
    camelized_name = $~[:name]
    underscored_name = underscorize(camelized_name)
    "#{field_type} :#{underscored_name}"
  end
end