Sha256: 75075da79184bb96cfa2fa09cd9690aedc15e00684092298845028d195756209

Contents?: true

Size: 570 Bytes

Versions: 6

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

require "json"

require_relative "./teyvatdb/version"
require_relative "./genshin_object"
require_relative "./genshin_data"

# Common helpers
module TeyvatDB
  class Error < StandardError; end

  class << self
    def kamera_key_to_filename(kamera_key)
      file_name = kamera_key.split(/([A-Z][a-z]+)/).reject { |s| s == "" }.map(&:downcase).join("_")
      "#{file_name}.json"
    end

    def filename_to_kamera_key(filename)
      file_id = filename.gsub(".json", "")
      file_id.split("_").map(&:capitalize).join
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
teyvatdb-0.1.18 lib/teyvatdb.rb
teyvatdb-0.1.17 lib/teyvatdb.rb
teyvatdb-0.1.16 lib/teyvatdb.rb
teyvatdb-0.1.15 lib/teyvatdb.rb
teyvatdb-0.1.14 lib/teyvatdb.rb
teyvatdb-0.1.13 lib/teyvatdb.rb