module GraphQLSchema::NamedHash

Public Instance Methods

camelize_name() click to toggle source
# File lib/graphql_schema.rb, line 56
def camelize_name
  @camelize_name ||= begin
    words = split_name.map(&:capitalize)
    words[0] = words[0].downcase
    words.join
  end
end
classify_name() click to toggle source
# File lib/graphql_schema.rb, line 64
def classify_name
  @classify_name ||= split_name.map(&:capitalize).join
end
description() click to toggle source
# File lib/graphql_schema.rb, line 72
def description
  @hash.fetch('description')
end
name() click to toggle source
# File lib/graphql_schema.rb, line 52
def name
  @hash.fetch('name')
end
to_h() click to toggle source
# File lib/graphql_schema.rb, line 76
def to_h
  @hash
end
upcase_name() click to toggle source
# File lib/graphql_schema.rb, line 68
def upcase_name
  @upcase_name ||= split_name.join("_").upcase
end

Private Instance Methods

split_name() click to toggle source
# File lib/graphql_schema.rb, line 82
def split_name
  @split_name ||= name.gsub(/([a-z])([A-Z0-9])/) { "#{$1}_#{$2}" }.split("_")
end