simpre 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simpre.rb +1 -3
- data/lib/simpre/helper.rb +2 -4
- data/lib/simpre/presenter.rb +9 -0
- data/lib/simpre/railtie.rb +2 -5
- data/lib/simpre/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e97c3313c962c3c47496438f5bb82d07b76baf31
|
4
|
+
data.tar.gz: 92f9537c07f664f987b18e5da4b11a91a854a295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a03c38dca5a2de2c3a8a22a6a3e50eeeb1420ada16213b99fa0451372ecae71326c701869d1ae2afe5f1df891cb53e38fb146e9f5fcdc521963179d58e1eebe2
|
7
|
+
data.tar.gz: 0f446cec167144b2ea9c0e4eba8a1ec8b70ecf71e9ddd49037a7f817a8785616ec87dfec73cec7a9d429da9716ea9a5490a2dec181e3458c33603236493842ef
|
data/lib/simpre.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
require 'simpre/helper'
|
2
2
|
require 'simpre/presenter'
|
3
3
|
require 'simpre/version'
|
4
|
-
require 'simpre/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
|
5
4
|
|
6
5
|
module Simpre
|
7
6
|
end
|
8
7
|
|
9
|
-
|
10
|
-
ActiveSupport.on_load(:action_view) { include Simpre::Helper }
|
8
|
+
require 'simpre/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
|
data/lib/simpre/helper.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
module Simpre
|
2
2
|
module Helper
|
3
|
-
|
4
3
|
def decorate(item_or_collection)
|
5
4
|
if item_or_collection.respond_to?(:map)
|
6
|
-
item_or_collection.map{ |item| decorate(item) }
|
5
|
+
item_or_collection.map { |item| decorate(item) }
|
7
6
|
else
|
8
7
|
item = item_or_collection
|
9
8
|
decorator = "#{item.class}Presenter".constantize
|
10
9
|
return item if decorator === item
|
11
|
-
decorator.new(item)
|
10
|
+
decorator.new(item, self)
|
12
11
|
end
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
16
14
|
end
|
data/lib/simpre/presenter.rb
CHANGED
data/lib/simpre/railtie.rb
CHANGED
data/lib/simpre/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simpre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Dyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|