Sha256: 4248430fd717b987e28845bdc958b2feeb2556225d5bc92c855f125726f56f83

Contents?: true

Size: 334 Bytes

Versions: 3

Compression:

Stored size: 334 Bytes

Contents

module Savage
  module Utils
    def bool_to_int(value)
      (value) ? 1 : 0
    end
    def constantize(string)
      unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ string
        raise NameError, "#{string.inspect} is not a valid constant name!"
      end
      Object.module_eval("::#{$1}", __FILE__, __LINE__)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
savage-1.0.1 lib/savage/utils.rb
savage-1.0.0 lib/savage/utils.rb
savage-0.2.0 lib/savage/utils.rb