agnostic_presenters 0.1.0 → 0.2.0

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.
data/README.md CHANGED
@@ -18,13 +18,13 @@ Class.send :include, AgnosticPresenters::Helper
18
18
  class MyModel
19
19
 
20
20
  # ...
21
-
21
+
22
22
  presenters do
23
-
23
+
24
24
  def myattribute
25
25
  "#{object.fancy} with a presenter"
26
26
  end
27
-
27
+
28
28
  end
29
29
  end
30
30
 
@@ -44,21 +44,21 @@ AgnosticPresenters::Base.send :include, Helpers</code></pre>
44
44
 
45
45
  ## Usage with Rails
46
46
 
47
- <pre><code>config.gem "yeastymobs-agnostic_presenters", :lib => "agnostic_presenters/activerecord", :source => "http://gems.github.com"</code></pre>
47
+ <pre><code>config.gem "agnostic_presenters", :lib => "agnostic_presenters/activerecord"</code></pre>
48
48
 
49
49
  And now you have presenters in your models which include ActionView helpers:
50
50
 
51
51
  <pre><code>class Article < ActiveRecord::Base
52
52
  presenters do
53
-
53
+
54
54
  def title
55
55
  h object.title
56
56
  end
57
-
57
+
58
58
  def slug
59
59
  object.title.parameterize
60
60
  end
61
-
61
+
62
62
  end
63
63
  end</code></pre>
64
64
 
@@ -68,9 +68,14 @@ If you use another ORM, just change "activerecord".
68
68
 
69
69
  * ActiveRecord "agnostic_presenters/activerecord"
70
70
  * MongoMapper "agnostic_presenters/mongomapper"
71
+ * MongoId "agnostic_presenters/mongoid"
71
72
 
72
73
  ## Credits
73
74
 
74
75
  * Nicolas Mérouze
75
76
  * A part of code is taken from active-record-presenters plugin
76
- * The proxy part is from nakajima-proxen gem
77
+ * The proxy part is from nakajima-proxen gem
78
+
79
+ * Cyril Mougel
80
+ * Gemify
81
+ * Add Mongoid support
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{agnostic_presenters}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nicolas M\303\251rouze"]
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "agnostic_presenters.gemspec",
25
25
  "lib/agnostic_presenters.rb",
26
26
  "lib/agnostic_presenters/activerecord.rb",
27
+ "lib/agnostic_presenters/mongoid.rb",
27
28
  "lib/agnostic_presenters/mongomapper.rb",
28
29
  "lib/base.rb",
29
30
  "lib/proxen.rb",
@@ -1,2 +1,2 @@
1
- require File.join(File.dirname(__FILE__), "../agnostic_presenters")
2
- ActiveRecord::Base.send :extend, AgnosticPresenters::Helper if defined?(ActiveRecord)
1
+ require "agnostic_presenters"
2
+ ActiveRecord::Base.send :extend, AgnosticPresenters::Helper if defined?(ActiveRecord)
@@ -0,0 +1,7 @@
1
+ require "agnostic_presenters"
2
+
3
+ if defined?(Mongoid::Document)
4
+ Mongoid::Document::ClassMethods.class_eval do
5
+ include AgnosticPresenters::Helper
6
+ end
7
+ end
@@ -1,2 +1,2 @@
1
- require File.join(File.dirname(__FILE__), "../agnostic_presenters")
1
+ require "agnostic_presenters"
2
2
  MongoMapper::Document.append_extensions(AgnosticPresenters::Helper) if defined?(MongoMapper)
@@ -1,4 +1,3 @@
1
- File.join(File.dirname(__FILE__), "../lib/agnostic_presenters")
2
1
  require 'base'
3
2
 
4
3
  if defined?(Rails)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agnostic_presenters
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Nicolas M\xC3\xA9rouze"
@@ -37,6 +37,7 @@ files:
37
37
  - agnostic_presenters.gemspec
38
38
  - lib/agnostic_presenters.rb
39
39
  - lib/agnostic_presenters/activerecord.rb
40
+ - lib/agnostic_presenters/mongoid.rb
40
41
  - lib/agnostic_presenters/mongomapper.rb
41
42
  - lib/base.rb
42
43
  - lib/proxen.rb