smack 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,12 +5,22 @@ Hi. This is dependency injection for the rest of us. See smack_test.rb for examp
5
5
  == FAQ
6
6
 
7
7
  Q: COOL IS THIS LIKE ONE OF THOSE JAVA DI FRAMEWORKS?
8
- A: No. This is an entire 15 lines of dumb code.
8
+
9
+ A: No. This is an entire 12 lines of dumb code.
10
+
9
11
 
10
12
  Q: WHY ARE YOU DOING DI IN RUBY ARE YOU A MANIAC?
13
+
11
14
  A: DI is a fine pattern and is sometimes necessary. It's just simpler to do in Ruby, hence the 15 lines of code. This just gives you nice syntax for it.
15
+
16
+
17
+ Q: SHOULD I USE THIS IN PRODUCTION CODE?
18
+
19
+ A: It's mostly a joke so probably not.
20
+
12
21
 
13
22
  Q: WHY ARE ALL YOUR PROJECT NAMES SO TERRIBLE?
23
+
14
24
  A: Marketing isn't really my strong point.
15
25
 
16
26
  == Copyright
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 2.0.0
@@ -1,14 +1,11 @@
1
1
  module Smack
2
- def self.init; Object.instance_eval { include Smack }; end
3
-
2
+ def self.up; Object.instance_eval { include Smack }; end
4
3
  def smack_inject(substitutions)
5
4
  (class << self; self; end).instance_eval { @smack_subs = (@smack_subs || {}).merge!(substitutions) }
6
5
  end
7
-
8
6
  def smack_get(klass_or_mod)
9
7
  [self, *(class << self; self; end).ancestors].any? { |mod| (found_mod = mod.smack_fetch(klass_or_mod)) ? (break(found_mod)) : nil } || klass_or_mod
10
8
  end
11
-
12
9
  def smack_fetch(klass_or_mod)
13
10
  (class << self; self; end).instance_eval { @smack_subs ? @smack_subs[klass_or_mod] : nil }
14
11
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{smack}
8
- s.version = "1.0.0"
8
+ s.version = "2.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ggironda"]
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- Smack.init
2
+ Smack.up
3
3
 
4
4
  class Useless
5
5
  def write_a_song
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ggironda