ruhl 0.14.0 → 0.15.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/VERSION +1 -1
- data/lib/ruhl/rails/active_record_presenter.rb +0 -21
- data/lib/ruhl/rails/form_helper.rb +5 -0
- data/lib/ruhl/rails/ruhl_presenter.rb +23 -2
- data/ruhl.gemspec +3 -2
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.15.0
|
@@ -8,27 +8,6 @@ module ActiveRecordPresenter
|
|
8
8
|
presentee.errors.full_messages
|
9
9
|
end
|
10
10
|
|
11
|
-
def method_missing(name, *args)
|
12
|
-
if presentee.respond_to?(name)
|
13
|
-
# Pass presenter method call to model so you don't have to
|
14
|
-
# redefine every model method in the presenter class.
|
15
|
-
presentee.send(name, *args)
|
16
|
-
elsif context.respond_to?(name)
|
17
|
-
# Instead of saying context.link_to('Some site', some_path)
|
18
|
-
# can just use link_to
|
19
|
-
context.send(name, *args)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Extend scope of respond_to? to model.
|
24
|
-
def respond_to?(name)
|
25
|
-
if super
|
26
|
-
true
|
27
|
-
else
|
28
|
-
presentee.respond_to?(name)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
11
|
def define_paths(model)
|
33
12
|
define_action(model, 'show') # show_path(@user)
|
34
13
|
define_action(model, 'update') # update_path(@user)
|
@@ -2,7 +2,8 @@ require 'ruhl/rails/active_record_presenter'
|
|
2
2
|
|
3
3
|
class RuhlPresenter
|
4
4
|
include ActiveRecordPresenter
|
5
|
-
|
5
|
+
include FormHelper
|
6
|
+
|
6
7
|
attr_reader :presentee, :context
|
7
8
|
|
8
9
|
def initialize(obj, context)
|
@@ -10,7 +11,27 @@ class RuhlPresenter
|
|
10
11
|
@context = context
|
11
12
|
define_paths(obj.class.name.underscore.downcase)
|
12
13
|
end
|
13
|
-
|
14
|
+
|
15
|
+
def method_missing(name, *args)
|
16
|
+
if presentee.respond_to?(name)
|
17
|
+
# Pass presenter method call to model so you don't have to
|
18
|
+
# redefine every model method in the presenter class.
|
19
|
+
presentee.send(name, *args)
|
20
|
+
elsif context.respond_to?(name)
|
21
|
+
# Instead of saying context.link_to('Some site', some_path)
|
22
|
+
# can just use link_to
|
23
|
+
context.send(name, *args)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Extend scope of respond_to? to model.
|
28
|
+
def respond_to?(name)
|
29
|
+
if super
|
30
|
+
true
|
31
|
+
else
|
32
|
+
presentee.respond_to?(name)
|
33
|
+
end
|
34
|
+
end
|
14
35
|
end
|
15
36
|
|
16
37
|
module ActionController
|
data/ruhl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruhl}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.15.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Stone"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-21}
|
13
13
|
s.description = %q{Make your HTML dynamic with the addition of a data-ruhl attribute.}
|
14
14
|
s.email = %q{andy@stonean.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"lib/ruhl/errors.rb",
|
26
26
|
"lib/ruhl/rails.rb",
|
27
27
|
"lib/ruhl/rails/active_record_presenter.rb",
|
28
|
+
"lib/ruhl/rails/form_helper.rb",
|
28
29
|
"lib/ruhl/rails/ruhl_presenter.rb",
|
29
30
|
"lib/ruhl/sinatra.rb",
|
30
31
|
"ruhl.gemspec",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruhl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-21 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- lib/ruhl/errors.rb
|
51
51
|
- lib/ruhl/rails.rb
|
52
52
|
- lib/ruhl/rails/active_record_presenter.rb
|
53
|
+
- lib/ruhl/rails/form_helper.rb
|
53
54
|
- lib/ruhl/rails/ruhl_presenter.rb
|
54
55
|
- lib/ruhl/sinatra.rb
|
55
56
|
- ruhl.gemspec
|