class Bisu::Config
Constants
- CONFIG_STRUCT
- DICTIONARY_STRUCT
- GOOGLE_SHEET_STRUCT
- ONE_SKY_STRUCT
- TOLGEE_STRUCT
- URL_STRUCT
Public Class Methods
new(hash:)
click to toggle source
# File lib/bisu/config.rb, line 3 def initialize(hash:) @hash = hash.deep_symbolize @hash.validate_structure!(CONFIG_STRUCT) unless dict_struct = DICTIONARY_STRUCT[@hash[:dictionary][:type]] raise ArgumentError.new("unknown dictionary type '#{@hash[:dictionary][:type]}'") end @hash[:dictionary].validate_structure!(dict_struct) end
Public Instance Methods
dictionary()
click to toggle source
# File lib/bisu/config.rb, line 18 def dictionary @hash[:dictionary] end
localize_files() { |t, (t || t) % l, l, l, l| ... }
click to toggle source
# File lib/bisu/config.rb, line 26 def localize_files @hash[:translate].each do |t| @hash[:languages].each do |l| downcase_locale = l[:locale].downcase.gsub("-", "_").gsub(" ", "_") yield(t[:in], (t[:"out_#{downcase_locale}"] || t[:out]) % l, l[:locale], l[:language], l[:fallback_language]) end end end
to_h()
click to toggle source
# File lib/bisu/config.rb, line 14 def to_h @hash end
type()
click to toggle source
# File lib/bisu/config.rb, line 22 def type @hash[:type] end