easy_partials 0.3.6 → 0.3.7

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.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{easy_partials}
8
- s.version = "0.3.6"
8
+ s.version = "0.3.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Samer Abukhait"]
@@ -7,7 +7,8 @@ module EasyPartials
7
7
  locations.push *additional_partials(method_str)
8
8
 
9
9
  begin
10
- new_method = partial_method locations, *args, &block
10
+ locals = partial_args *args, &block
11
+ new_method = partial_method locations, locals
11
12
  meta_def_with_block method_name, &new_method
12
13
  rescue ActionView::MissingTemplate
13
14
  super
@@ -24,7 +25,7 @@ module EasyPartials
24
25
  # method_missing will have to be invoked each time the partial is
25
26
  # invoked). The locations parameter is modified in the process.
26
27
  # This is used by method_missing.
27
- def partial_method(locations, *args, &block)
28
+ def partial_method(locations, locals)
28
29
  raise "No possible locations!" if locations.empty?
29
30
  partial_name = locations.delete_at 0
30
31
 
@@ -37,19 +38,19 @@ module EasyPartials
37
38
  end
38
39
 
39
40
  begin
40
- new_method.call block, *args
41
+ new_method.call nil, locals
41
42
  rescue ActionView::MissingTemplate
42
43
  if locations.empty?
43
44
  raise
44
45
  else
45
- new_method = partial_method locations, *args, &block
46
+ new_method = partial_method locations, locals
46
47
  end
47
48
  end
48
49
 
49
50
  new_method
50
51
  end
51
52
 
52
- def invoke_partial(partial, *args, &block)
53
+ def partial_args(*args, &block)
53
54
  locals = {}
54
55
 
55
56
  if args.length == 1 && args[0].is_a?(Hash)
@@ -58,10 +59,14 @@ module EasyPartials
58
59
  locals.merge! :args => args
59
60
  end
60
61
 
61
- locals[:options] = locals.dup unless locals.has_key?(:options)
62
-
63
62
  locals.merge! :body => capture(&block) if block
64
63
  locals[:body] = nil unless locals[:body]
64
+ locals
65
+ end
66
+
67
+ def invoke_partial(partial, *args, &block)
68
+ locals = partial_args *args, &block
69
+ locals[:options] = locals.dup unless locals.has_key?(:options)
65
70
 
66
71
  if locals.has_key? :collection
67
72
  return "" if locals[:collection].blank?
metadata CHANGED
@@ -1,40 +1,37 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: easy_partials
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.7
4
5
  prerelease:
5
- version: 0.3.6
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Samer Abukhait
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-01 00:00:00 -07:00
12
+ date: 2011-06-08 00:00:00.000000000 -07:00
14
13
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: rspec
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &83644060 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
24
22
  version: 1.2.9
25
23
  type: :development
26
- version_requirements: *id001
24
+ prerelease: false
25
+ version_requirements: *83644060
27
26
  description: An easier way to call partials
28
27
  email: abukhait@gmail.com
29
28
  executables: []
30
-
31
29
  extensions: []
32
-
33
- extra_rdoc_files:
30
+ extra_rdoc_files:
34
31
  - LICENSE
35
32
  - README.rdoc
36
33
  - TODO
37
- files:
34
+ files:
38
35
  - .document
39
36
  - .gitignore
40
37
  - LICENSE
@@ -52,31 +49,29 @@ files:
52
49
  has_rdoc: true
53
50
  homepage: http://github.com/on-site/Easy-Partials
54
51
  licenses: []
55
-
56
52
  post_install_message:
57
- rdoc_options:
53
+ rdoc_options:
58
54
  - --charset=UTF-8
59
- require_paths:
55
+ require_paths:
60
56
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
57
+ required_ruby_version: !ruby/object:Gem::Requirement
62
58
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: "0"
67
- required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
64
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: "0"
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
73
69
  requirements: []
74
-
75
70
  rubyforge_project: easy_partials
76
71
  rubygems_version: 1.6.2
77
72
  signing_key:
78
73
  specification_version: 3
79
74
  summary: Easy Partials
80
- test_files:
75
+ test_files:
81
76
  - spec/easy_partials_spec.rb
82
77
  - spec/spec_helper.rb