eager_decorator 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40c3bf410755b9dfcb50e51948c367550b1aeb21
4
- data.tar.gz: 62a3e22b36b742d28eef28b3ef32ea86948e972c
3
+ metadata.gz: 4543dd7b9fc0611051def1381595ea0198d5351f
4
+ data.tar.gz: 4a873f64ed6872f2a7bd2b873be0d8e39827181f
5
5
  SHA512:
6
- metadata.gz: 7c1e2c5f8a7f220da57b6c9deca25fb12be8598e00cdb213c97acc90a92ac96e32c9939f91bb344e24bbb2fe65f7dd301cc0b946b446978534426d646dd8f8ee
7
- data.tar.gz: d8c20de6e4bc024ea026c57362431e0a1eee5acea78f95dbdef2e4e25a25e1b18a9d8b7328e46cf027b33d07af9836be36e4750c1a881586eaa13e6e2c55e16d
6
+ metadata.gz: 1d0e2c8ede2ac71463cd4e0018c4f9c5a2923eb5958d5635f97f614cdb0273f2f7bad4ce4f52bac20735bf31d79a7de0666160ffbfc64d909ea81d922b5c2265
7
+ data.tar.gz: 572cb3a21c761a040d816bdbf83c17f09bf8e082ed78c808b325679419715f26cb98a691d9da356b3dd3e561bece60fc15bb4568db5602b7749455855292bbb1
data/README.md CHANGED
@@ -20,11 +20,7 @@ $ rails g decorator user
20
20
  ## Supported versions
21
21
 
22
22
  * Ruby 1.9.3, 2.0.0, 2.1.0
23
- * Rails 3.2.0, 4.0.0, 4.1.0, 4.2.0
24
-
25
- ## Supported ORMs
26
-
27
- * ActiveRecord
23
+ * Rails 3.2, 4.0, 4.1, 4.2
28
24
 
29
25
  ## Copyright
30
26
 
@@ -1,19 +1,15 @@
1
1
  require "rails"
2
2
  require "eager_decorator/version"
3
- require "eager_decorator/hooks"
4
3
  require "eager_decorator/railtie"
5
4
 
6
5
  module EagerDecorator
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- class << self
11
- def inherited_with_decorator(klass)
12
- decorator = "#{klass.name.classify}Decorator".safe_constantize
13
- klass.send(:include, decorator) if decorator
14
- inherited_without_decorator(klass)
15
- end
16
- alias_method_chain(:inherited, :decorator)
6
+ def self.decorate cache_classes
7
+ Dir.glob(Rails.root + "app/decorators/**/*.rb").each do |file|
8
+ load file unless cache_classes
9
+ klass_name = File.basename(file, ".rb").sub /_decorator/, ""
10
+ klass = klass_name.classify.safe_constantize
11
+ decorator = "#{klass_name.classify}Decorator".safe_constantize
12
+ klass.send :include, decorator if decorator
17
13
  end
18
14
  end
19
15
  end
@@ -1,7 +1,9 @@
1
1
  module EagerDecorator
2
2
  class Railtie < ::Rails::Railtie
3
3
  initializer "eager_decorator" do
4
- EagerDecorator::Hooks.init
4
+ config.to_prepare do
5
+ EagerDecorator.decorate Rails.application.config.cache_classes
6
+ end
5
7
  end
6
8
  end
7
9
  end
@@ -1,3 +1,3 @@
1
1
  module EagerDecorator
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eager_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - KoyaFukuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-04 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple Decorator for Rails
14
14
  email:
@@ -30,7 +30,6 @@ files:
30
30
  - gemfiles/Gemfile-rails.4.1.x
31
31
  - gemfiles/Gemfile-rails.4.2.x
32
32
  - lib/eager_decorator.rb
33
- - lib/eager_decorator/hooks.rb
34
33
  - lib/eager_decorator/railtie.rb
35
34
  - lib/eager_decorator/version.rb
36
35
  - lib/generators/rails/decorator_generator.rb
@@ -1,11 +0,0 @@
1
- module EagerDecorator
2
- class Hooks
3
- class << self
4
- def init
5
- ActiveSupport.on_load(:active_record) do
6
- ::ActiveRecord::Base.send(:include, EagerDecorator)
7
- end
8
- end
9
- end
10
- end
11
- end