liquid_loader 0.0.5 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1 +1,7 @@
1
+ LiquidLoader
2
+ ========
3
+
1
4
  This is LiquidLoader - a simple way to expose your models to liquid by automatically loading instances into drops.
5
+
6
+ ## Update - 02 July 2012
7
+ It hasn't really been under active development since I made it as a hack for a project, but I've needed some more functionality from it, so expect to see more soon.
@@ -3,14 +3,14 @@ require 'liquid'
3
3
  module LiquidLoader
4
4
  module Context
5
5
 
6
- def render_liquid(template, context = nil)
6
+ def render_layout(template, context = nil)
7
7
  ctx = (context ? context : liq)
8
8
  template.render(ctx)
9
9
  end
10
10
 
11
- def pre_render_liquid(template, destination, context = nil)
11
+ def render_template(template, destination, context = nil)
12
12
  ctx = (context ? context : liq)
13
- add_context(destination => render_liquid(template, ctx))
13
+ add_context(destination => render_layout(template, ctx))
14
14
  end
15
15
 
16
16
  def add_context(opts = nil)
@@ -20,6 +20,14 @@ module LiquidLoader
20
20
  end
21
21
  end
22
22
  end
23
+
24
+ def add_register(opts = nil)
25
+ if opts.is_a? Hash
26
+ opts.each do |k, v|
27
+ liq.registers[k.to_sym] = v
28
+ end
29
+ end
30
+ end
23
31
 
24
32
  private
25
33
  def liq
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  class Base
3
3
  def to_liquid
4
- (self.class.to_s + "Drop").constantize.new(self)
4
+ (self.class.to_s.split("::").last + "Drop").constantize.new(self)
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module LiquidLoader
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1"
3
3
  end
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
23
  s.add_runtime_dependency "liquid"
24
- s.add_runtime_dependency "rails", "~> 3.1.0"
24
+ s.add_runtime_dependency "rails"
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquid_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: '0.1'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-17 00:00:00.000000000Z
12
+ date: 2012-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: liquid
16
- requirement: &8614840 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,18 +21,28 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8614840
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rails
27
- requirement: &8614000 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
- - - ~>
35
+ - - ! '>='
31
36
  - !ruby/object:Gem::Version
32
- version: 3.1.0
37
+ version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *8614000
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: See Summary
37
47
  email:
38
48
  - JGW Maxwell
@@ -64,15 +74,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
74
  - - ! '>='
65
75
  - !ruby/object:Gem::Version
66
76
  version: '0'
77
+ segments:
78
+ - 0
79
+ hash: -1883388936165170843
67
80
  required_rubygems_version: !ruby/object:Gem::Requirement
68
81
  none: false
69
82
  requirements:
70
83
  - - ! '>='
71
84
  - !ruby/object:Gem::Version
72
85
  version: '0'
86
+ segments:
87
+ - 0
88
+ hash: -1883388936165170843
73
89
  requirements: []
74
90
  rubyforge_project: liquid_loader
75
- rubygems_version: 1.8.10
91
+ rubygems_version: 1.8.24
76
92
  signing_key:
77
93
  specification_version: 3
78
94
  summary: This gem provides a simple include method to auto-generate liquid drops from