Sha256: 9dba587771e5beef7ad02bd58a5596d20ee5008c2e0d7c377e399d2df4278a57
Contents?: true
Size: 856 Bytes
Versions: 2
Compression:
Stored size: 856 Bytes
Contents
# frozen_string_literal: true module LIT # @api private # @since 0.1.0 module Utils def self.camelize(string) string.to_s.split("_").collect(&:capitalize).join end # @api private # @since 0.1.0 class MapHash attr_reader :values def initialize(values) @values = values.transform_keys { |k| k.is_a?(Symbol) ? k.to_s : k } end def [](key) key = key.is_a?(Symbol) ? key.to_s : key @values[key] end def each(&block) @values.each(&block) end def to_h @values end end # @api private # @since 0.1.0 def self.const_reset(mod, const_name, const_value) if mod.const_defined?(const_name, false) mod.send(:remove_const, const_name) end mod.const_set(const_name, const_value) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
litl-0.1.1 | lib/lit/utils.rb |
litl-0.1.0 | lib/lit/utils.rb |