Sha256: ad4470b27541f44d4a0f1f22312d8d5e4953c6d179601a668df7c7d7800a7e17

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

module Smack
  def self.up; Object.instance_eval { include Smack }; end
  def smack_inject(substitutions)
    (class << self; self; end).instance_eval { @smack_subs = (@smack_subs || {}).merge!(substitutions) }
  end
  def smack_get(klass_or_mod)
    [self, *(class << self; self; end).ancestors].any? { |mod| (found_mod = mod.smack_fetch(klass_or_mod)) ? (break(found_mod)) : nil } || klass_or_mod
  end
  def smack_fetch(klass_or_mod)
    (class << self; self; end).instance_eval { @smack_subs ? @smack_subs[klass_or_mod] : nil }
  end
end # Smack

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smack-2.0.0 lib/smack.rb