Sha256: f6d113200b4db19f980f9a4d09d5122647a07cc7818bf65ef8d83d8e81548c24

Contents?: true

Size: 363 Bytes

Versions: 6

Compression:

Stored size: 363 Bytes

Contents

module Sham
  module Util
    def self.extract_options!(ary)
      ary.last.is_a?(::Hash) ? ary.pop : {}
    end

    def self.constantize(word)
      unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ word
        raise NameError, "#{word.inspect} is not a valid constant name!"
      end

      Object.module_eval("::#{$1}", __FILE__, __LINE__)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sham-2.0.0 lib/sham/util.rb
sham-1.2.0 lib/sham/util.rb
sham-1.1.0 lib/sham/util.rb
sham-1.0.3 lib/sham/util.rb
sham-1.0.2 lib/sham/util.rb
sham-1.0.1 lib/sham/util.rb