gleborator 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15b48d5e091894f8abee115fd92d6b2a2c73e3f4
4
- data.tar.gz: 050fb703aa2672763001698823190f435df5fd9e
3
+ metadata.gz: a08a5b230f4d6beaba24e094732d224cc93e02d5
4
+ data.tar.gz: 20029418b869c80f676784885b494d16b314abaf
5
5
  SHA512:
6
- metadata.gz: 8774dbec364316ce5cbbc7d9cef5a03a0299a531e7601bcb2f0020b9478f22287602b28c91b4b9400cf7d4267d25a67bfcef853b81b580a962e72bee358f4a52
7
- data.tar.gz: c7e595bdb62f01479c2706d9cd7fe6ebee88338dbdc87ad390c78b10b13eaec034f045547b489577e3b94d49b5c7e42951b343177ea84b84410058a4a1677305
6
+ metadata.gz: 886081689145f21379a3f13f6c445288d3bb8c455dd27a7e80d01806db0dd7e7bc1d7edf2c1d991b85702d6296829847a88ae54e24c78b2ee1559bb7f6d45375
7
+ data.tar.gz: e2b7341d60f2f5b0835dc38d5c0fed7f740c808e7fbca3ce396891b5d18a6300b99b9f95595f3702c27ef6d9cc7e80d4eeb37cece9ffe702735cf3e397f5ea97
data/.DS_Store ADDED
Binary file
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in gleborator.gemspec
4
4
  gemspec
5
+
6
+ gem "rails", "~> 5.0"
data/lib/.DS_Store ADDED
Binary file
@@ -8,7 +8,7 @@ module Gleborator
8
8
  if object.respond_to? :map
9
9
 
10
10
  else
11
-
11
+ new(object)
12
12
  end
13
13
  end
14
14
  end
@@ -0,0 +1,13 @@
1
+ require 'rails/railtie'
2
+
3
+ module Gleborator
4
+ class Railtie < Rails::Railtie
5
+
6
+ initializer "draper.active_record" do |app|
7
+ ActiveSupport.on_load :active_record do
8
+ Gleborator.setup self
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ module Gleborator
2
+ module Setup
3
+ def decorate
4
+ begin
5
+ decorator_class = "#{self.class.name}Decorator".constantize
6
+ decorator_class.wrap(self)
7
+ rescue NameError => e
8
+ raise "Couldn't find decorator #{self.class.name}Decorator"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Gleborator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/gleborator.rb CHANGED
@@ -1,4 +1,12 @@
1
1
  require "gleborator/version"
2
+ require "gleborator/base_decorator"
3
+ require "gleborator/setup"
4
+ require "gleborator/railtie" if defined?(Rails)
2
5
 
3
6
  module Gleborator
7
+ def self.setup(klass)
8
+ klass.class_eval do
9
+ include Gleborator::Setup
10
+ end
11
+ end
4
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gleborator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Vishnevsky
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".DS_Store"
62
63
  - ".gitignore"
63
64
  - ".rspec"
64
65
  - ".travis.yml"
@@ -69,8 +70,11 @@ files:
69
70
  - bin/console
70
71
  - bin/setup
71
72
  - gleborator.gemspec
73
+ - lib/.DS_Store
72
74
  - lib/gleborator.rb
73
- - lib/gleborator/BaseDecorator.rb
75
+ - lib/gleborator/base_decorator.rb
76
+ - lib/gleborator/railtie.rb
77
+ - lib/gleborator/setup.rb
74
78
  - lib/gleborator/version.rb
75
79
  homepage: https://github.com/kaikash/gleborator
76
80
  licenses: