Sha256: f5b4522839619307d9aaa5a6bdee0ec1d34de7ac0de425192486df8dbb83a722

Contents?: true

Size: 1.89 KB

Versions: 10

Compression:

Stored size: 1.89 KB

Contents

module BBK
  module Utils
    class Config

      class BooleanCaster
        FALSE_VALUES: Array[bool | Integer | String | Symbol]
        def self.cast: (untyped value) -> (bool|nil)
      end

      interface _CallableCaster
        def call: (String) -> untyped
      end

      interface _ClassCaster
        def new: (String) -> untyped
      end

      type typeCaster = _CallableCaster | _ClassCaster
      type configItem = {env: String, file: String?, required: bool, desc: String?, bool: bool, value: untyped, default: untyped, type: typeCaster?}
      type envSource = _ENV | ENVClass

      attr_accessor store: untyped
      attr_accessor name: String?

      def self.instance: () -> instance
      
      def initialize: (?name: String?, ?prefix: String?, ?parent: BBK::Utils::Config?) -> void
      def map: (envSource env, String file, ?required: bool, ?desc: String, ?bool: bool, ?key: String) -> void
      def require: (envSource env, ?desc: String?, ?bool: bool, ?type: typeCaster, ?key: String?) -> void
      def optional: (envSource env, ?default: untyped, ?desc: String, ?bool: bool, ?type: typeCaster, ?key: String) -> void

      def run!: (?envSource source) -> void
      def []: (String key) -> untyped
      def []=: (String key, untyped value) -> void
      def content: (String key) -> untyped
      def fetch: (String key, ?untyped default) -> untyped
      # def to_s: () -> String
      def as_json: (*untyped) -> Hash[String, untyped]
      def to_json: (*untyped) -> String
      def to_yaml: (*untyped) -> String

      private

      def normalize_key: (String? key) -> String?
      def process: (envSource source, configItem item) -> void

      def required!: (configItem item) -> void
      def print_file_item: (configItem item, String padding) -> String
      def print_item: (configItem item, String padding) -> String
      def wrap_required: (configItem item) -> String


    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bbk-utils-1.1.0.181866 sig/bbk/config.rbs
bbk-utils-1.1.0.149110 sig/bbk/config.rbs
bbk-utils-1.0.1.147183 sig/bbk/config.rbs
bbk-utils-1.0.1.136047 sig/bbk/config.rbs
bbk-utils-1.0.1.133029 sig/bbk/config.rbs
bbk-utils-1.0.1.102369 sig/bbk/config.rbs
bbk-utils-1.0.1.100402 sig/bbk/config.rbs
bbk-utils-1.0.1.100401 sig/bbk/config.rbs
bbk-utils-1.0.1.97958 sig/bbk/config.rbs
bbk-utils-1.0.1.97943 sig/bbk/config.rbs