locomotive_plugins 1.0.0.beta5 → 1.0.0.beta6

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.
@@ -44,8 +44,8 @@ module Locomotive
44
44
  raw_filter_modules.each do |mod|
45
45
  mod.public_instance_methods.each do |meth|
46
46
  @prefixed_liquid_filter_module.module_eval do
47
- define_method(:"#{prefix}_#{meth}") do |input|
48
- self._passthrough_filter_call(prefix, meth, input)
47
+ define_method(:"#{prefix}_#{meth}") do |*args|
48
+ self._passthrough_filter_call(prefix, meth, *args)
49
49
  end
50
50
  end
51
51
  end
@@ -53,12 +53,12 @@ module Locomotive
53
53
  # @param meth [Symbol] the method to call
54
54
  # @param input [String] the input to the method
55
55
  # @return the result of calling the method on the passthrough object
56
- def _passthrough_filter_call(prefix, meth, input)
56
+ def _passthrough_filter_call(prefix, meth, *args)
57
57
  # Setup context object and call the passthrough
58
58
  output = nil
59
59
 
60
60
  ContextHelpers.add_plugin_object_to_context(prefix, @context) do
61
- output = self._passthrough_object(prefix).__send__(meth, input)
61
+ output = self._passthrough_object(prefix).__send__(meth, *args)
62
62
  end
63
63
 
64
64
  output
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module LocomotivePlugins
2
- VERSION = '1.0.0.beta5'
2
+ VERSION = '1.0.0.beta6'
3
3
  end
@@ -63,11 +63,13 @@ module Locomotive
63
63
  it 'should contain all prefixed methods for provided filter modules' do
64
64
  mod = @plugin_with_filter_class.prefixed_liquid_filter_module('prefix')
65
65
  mod.public_instance_methods.should include(:prefix_add_http)
66
+ mod.public_instance_methods.should include(:prefix_link_to)
66
67
  end
67
68
 
68
69
  it 'should not contain any of the original methods' do
69
70
  mod = @plugin_with_filter_class.prefixed_liquid_filter_module('prefix')
70
71
  mod.public_instance_methods.should_not include(:add_http)
72
+ mod.public_instance_methods.should_not include(:link_to)
71
73
  end
72
74
 
73
75
  it 'the prefixed methods should pass through to the original methods' do
@@ -111,6 +113,12 @@ module Locomotive
111
113
  obj.context.should == strainer.context
112
114
  end
113
115
 
116
+ it 'should support filters with multiple arguments' do
117
+ strainer.extend(@plugin_with_filter_class.prefixed_liquid_filter_module('prefix'))
118
+ strainer.prefix_link_to('My Link', 'http://www.example.com').should \
119
+ == %{<a href="http://www.example.com">My Link</a>}
120
+ end
121
+
114
122
  end
115
123
 
116
124
  describe 'liquid tags' do
@@ -11,6 +11,10 @@ module Locomotive
11
11
  "http://#{input}"
12
12
  end
13
13
  end
14
+
15
+ def link_to(input, href)
16
+ %{<a href="#{href}">#{input}</a>}
17
+ end
14
18
  end
15
19
 
16
20
  def self.liquid_filters
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotive_plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta5
4
+ version: 1.0.0.beta6
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-16 00:00:00.000000000 Z
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: locomotive_liquid