liquid_tag_with_params 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca5747bea28fc86c5accc7ab752b2b9ef106cead
4
- data.tar.gz: 53b49b6ada98f8dd4ffa59efe2526aac17b47fbd
3
+ metadata.gz: 82598649edec7d4e16443a6e3d689aeeb2ad0a9d
4
+ data.tar.gz: f9fd29cdfce5652b2764b86e5841d43364dae6b7
5
5
  SHA512:
6
- metadata.gz: a5a4b22718eb3a49d228e34f8c176fcd06d423dbcac94bfd4a2ffee9d65ca67b4697ebfeb26e1ccc5adf0f898af19ad69416b3889481ef598057f2b2bdb2f500
7
- data.tar.gz: af8883b3b9be338744eeab7fa25caf0e5a225ae32a1dd5413a4226229f2b9492840fc683e517b632d79031c4a9c48a89884f0e1d2e15558316adf309d6f0e244
6
+ metadata.gz: 7671cc7d9ad66c16f87904ddba1809a005dcfb3c30add0c5bfce641f267248c27dbea4455cc1819a95429260f1ef0b47c78af1fd8d37485ff323f2bb17f1b3fe
7
+ data.tar.gz: bd7bee81e654d3c8cafac679740edaafe9e2b7b6bb99b4206d40710a3e0ede5e4fac709f81b374ca74d67363cb0f09c395e98bc2e4c73656087c19bd46d70d70
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ .DS_Store
data/README.md CHANGED
@@ -20,6 +20,8 @@ string and will make parameters out of it so you can use them during rendering.
20
20
  Here's an example of such tag:
21
21
 
22
22
  ```ruby
23
+ require 'liquid/tag_with_params'
24
+
23
25
  class ShuffleTag < Liquid::TagWithParams
24
26
  def initialize(tag_name, params, tokens)
25
27
  super
@@ -1,5 +1,4 @@
1
1
  require 'liquid'
2
- require_relative 'liquid_tag_with_params/parser'
3
2
 
4
3
  class Liquid::TagWithParams < Liquid::Tag
5
4
 
@@ -7,10 +6,12 @@ class Liquid::TagWithParams < Liquid::Tag
7
6
 
8
7
  def initialize(tag_name, markup, parse_context)
9
8
  super
10
- @params = LiquidTagWithParams::Parser.parse(markup)
9
+ @params = Liquid::TagWithParams::Parser.parse(markup)
11
10
  end
12
11
 
13
12
  def render(_context)
14
13
  ""
15
14
  end
16
15
  end
16
+
17
+ require_relative 'tag_with_params/parser'
@@ -1,4 +1,4 @@
1
- module LiquidTagWithParams::Parser
1
+ module Liquid::TagWithParams::Parser
2
2
 
3
3
  SINGLE_STRING_LITERAL = /'[^\']*'/
4
4
  DOUBLE_STRING_LITERAL = /"[^\"]*"/
@@ -34,7 +34,7 @@ module LiquidTagWithParams::Parser
34
34
  def self.collect_param_for_hash!(params, tokens)
35
35
  key, col, val = tokens
36
36
  key_type, key_value = key
37
- col_type, col_value = col
37
+ col_type, _ = col
38
38
  val_type, val_value = val
39
39
 
40
40
  unless key_type == :string && col_type == :column && val_type == :string
@@ -1,3 +1,3 @@
1
1
  module LiquidTagWithParams
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  $:.unshift File.expand_path('../lib', __FILE__)
2
- require 'liquid_tag_with_params/version'
2
+ require 'liquid/tag_with_params/version'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "liquid_tag_with_params"
@@ -1,102 +1,102 @@
1
- require_relative '../test_helper'
1
+ require_relative '../../test_helper'
2
2
 
3
- class LiquidTagWithParams::ParserTest < MiniTest::Test
3
+ class Liquid::TagWithParams::ParserTest < MiniTest::Test
4
4
 
5
5
  def test_tokenizer
6
- tokens = LiquidTagWithParams::Parser.tokenize("param")
6
+ tokens = Liquid::TagWithParams::Parser.tokenize("param")
7
7
  assert_equal [[:string, "param"]], tokens
8
8
  end
9
9
 
10
10
  def test_tokenizer_with_commas
11
- tokens = LiquidTagWithParams::Parser.tokenize("param_a, param_b")
11
+ tokens = Liquid::TagWithParams::Parser.tokenize("param_a, param_b")
12
12
  assert_equal [[:string, "param_a"], [:comma, ","], [:string, "param_b"]], tokens
13
13
  end
14
14
 
15
15
  def test_tokenizer_with_columns
16
- tokens = LiquidTagWithParams::Parser.tokenize("key: value")
16
+ tokens = Liquid::TagWithParams::Parser.tokenize("key: value")
17
17
  assert_equal [[:string, "key"], [:column, ":"], [:string, "value"]], tokens
18
18
  end
19
19
 
20
20
  def test_tokenizer_with_quoted_value
21
- tokens = LiquidTagWithParams::Parser.tokenize("key: 'v1, v2: v3'")
21
+ tokens = Liquid::TagWithParams::Parser.tokenize("key: 'v1, v2: v3'")
22
22
  assert_equal [[:string, "key"], [:column, ":"], [:string, "'v1, v2: v3'"]], tokens
23
23
 
24
- tokens = LiquidTagWithParams::Parser.tokenize('key: "v1, v2: v3"')
24
+ tokens = Liquid::TagWithParams::Parser.tokenize('key: "v1, v2: v3"')
25
25
  assert_equal [[:string, "key"], [:column, ":"], [:string, '"v1, v2: v3"']], tokens
26
26
  end
27
27
 
28
28
  def test_tokenizer_with_bad_input
29
29
  assert_exception_raised do
30
- LiquidTagWithParams::Parser.tokenize("%")
30
+ Liquid::TagWithParams::Parser.tokenize("%")
31
31
  end
32
32
  end
33
33
 
34
34
  def test_slice
35
35
  tokens = [[:string, "a"], [:comma, ","], [:string, "b"]]
36
- token_groups = LiquidTagWithParams::Parser.slice(tokens)
36
+ token_groups = Liquid::TagWithParams::Parser.slice(tokens)
37
37
  assert_equal [[[:string, "a"]], [[:string, "b"]]], token_groups
38
38
  end
39
39
 
40
40
  def test_parameterize
41
41
  token_groups = [[[:string, "a"]]]
42
- params = LiquidTagWithParams::Parser.parameterize(token_groups)
42
+ params = Liquid::TagWithParams::Parser.parameterize(token_groups)
43
43
  assert_equal ["a"], params
44
44
 
45
45
  token_groups = [[[:string, "a"], [:column, ":"], [:string, "b"]]]
46
- params = LiquidTagWithParams::Parser.parameterize(token_groups)
46
+ params = Liquid::TagWithParams::Parser.parameterize(token_groups)
47
47
  assert_equal [{"a" => "b"}], params
48
48
  end
49
49
 
50
50
  def test_parameterize_with_bad_input
51
51
  token_groups = [[[:string, "a"], [:string, "b"]]]
52
52
  assert_exception_raised do
53
- LiquidTagWithParams::Parser.parameterize(token_groups)
53
+ Liquid::TagWithParams::Parser.parameterize(token_groups)
54
54
  end
55
55
  end
56
56
 
57
57
  def test_collect_param_for_string!
58
58
  params = []
59
- LiquidTagWithParams::Parser.collect_param_for_string!(params, [:string, "a"])
59
+ Liquid::TagWithParams::Parser.collect_param_for_string!(params, [:string, "a"])
60
60
  assert_equal ["a"], params
61
61
  end
62
62
 
63
63
  def test_collect_param_for_string_with_bad_input
64
64
  assert_exception_raised do
65
- LiquidTagWithParams::Parser.collect_param_for_string!([], [:invalid, "a"])
65
+ Liquid::TagWithParams::Parser.collect_param_for_string!([], [:invalid, "a"])
66
66
  end
67
67
  end
68
68
 
69
69
  def test_collect_param_for_hash!
70
70
  params = []
71
71
  tokens = [[:string, "a"], [:column, ":"], [:string, "b"]]
72
- LiquidTagWithParams::Parser.collect_param_for_hash!(params, tokens)
72
+ Liquid::TagWithParams::Parser.collect_param_for_hash!(params, tokens)
73
73
  assert_equal [{"a" => "b"}], params
74
74
  end
75
75
 
76
76
  def test_collect_param_for_hash_with_trailing_hash
77
77
  params = ["x", {"y" => "z"}]
78
78
  tokens = [[:string, "a"], [:column, ":"], [:string, "b"]]
79
- LiquidTagWithParams::Parser.collect_param_for_hash!(params, tokens)
79
+ Liquid::TagWithParams::Parser.collect_param_for_hash!(params, tokens)
80
80
  assert_equal ["x", {"y" => "z", "a" => "b"}], params
81
81
  end
82
82
 
83
83
  def test_collect_param_for_hash_with_trailing_param
84
84
  params = ["x", {"y" => "z"}, "k"]
85
85
  tokens = [[:string, "a"], [:column, ":"], [:string, "b"]]
86
- LiquidTagWithParams::Parser.collect_param_for_hash!(params, tokens)
86
+ Liquid::TagWithParams::Parser.collect_param_for_hash!(params, tokens)
87
87
  assert_equal ["x", {"y" => "z"}, "k", {"a" => "b"}], params
88
88
  end
89
89
 
90
90
  def test_collect_param_for_hash_with_bad_input
91
91
  assert_exception_raised do
92
92
  tokens = [[:string, "a"], [:invalid, ":"], [:string, "b"]]
93
- LiquidTagWithParams::Parser.collect_param_for_hash!([], tokens)
93
+ Liquid::TagWithParams::Parser.collect_param_for_hash!([], tokens)
94
94
  end
95
95
  end
96
96
 
97
97
  def test_parse
98
98
  text = "param_a, param_b, key_a: val_a, key_b: val_b, param_c, key_c: val_c"
99
- params = LiquidTagWithParams::Parser.parse(text)
99
+ params = Liquid::TagWithParams::Parser.parse(text)
100
100
  assert_equal [
101
101
  "param_a",
102
102
  "param_b",
@@ -1,6 +1,6 @@
1
- require_relative 'test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
- class LiquidTagWithParamsTest < MiniTest::Test
3
+ class Liquid::TagWithParamsTest < MiniTest::Test
4
4
  include Liquid
5
5
 
6
6
  def test_initialization
data/test/test_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  require 'minitest/autorun'
3
- require 'liquid_tag_with_params'
3
+ require 'liquid/tag_with_params'
4
4
 
5
5
  class MiniTest::Test
6
6
 
@@ -24,5 +24,4 @@ class MiniTest::Test
24
24
  flunk 'Exception was not raised'
25
25
  end
26
26
  end
27
-
28
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquid_tag_with_params
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-15 00:00:00.000000000 Z
11
+ date: 2017-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -31,17 +31,17 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".gitignore"
34
35
  - Gemfile
35
- - Gemfile.lock
36
36
  - LICENSE
37
37
  - README.md
38
38
  - Rakefile
39
- - lib/liquid_tag_with_params.rb
40
- - lib/liquid_tag_with_params/parser.rb
41
- - lib/liquid_tag_with_params/version.rb
39
+ - lib/liquid/tag_with_params.rb
40
+ - lib/liquid/tag_with_params/parser.rb
41
+ - lib/liquid/tag_with_params/version.rb
42
42
  - liquid_tag_with_params.gemspec
43
- - test/liquid_tag_with_params/parser_test.rb
44
- - test/liquid_tag_with_params_test.rb
43
+ - test/liquid/tag_with_params/parser_test.rb
44
+ - test/liquid/tag_with_params_test.rb
45
45
  - test/test_helper.rb
46
46
  homepage: http://github.com/comfy/liquid_tag_with_params
47
47
  licenses: []
data/Gemfile.lock DELETED
@@ -1,23 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- liquid_tag_with_params (0.0.1)
5
- liquid (>= 4.0.0)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- liquid (4.0.0)
11
- minitest (5.10.3)
12
- rake (12.1.0)
13
-
14
- PLATFORMS
15
- ruby
16
-
17
- DEPENDENCIES
18
- liquid_tag_with_params!
19
- minitest
20
- rake
21
-
22
- BUNDLED WITH
23
- 1.14.6