gtm_on_rails 0.1.6 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a98db43f94fbddb2e1e5141b5953f81c3bf6d90d
4
- data.tar.gz: 4e833f8a318aff40b6477e891324138566c9a18f
3
+ metadata.gz: bf2d915f6db050d579fa7f4cb73b1923323b0f77
4
+ data.tar.gz: 33b15520b4b2e31d46b151372ee24f9c558ae928
5
5
  SHA512:
6
- metadata.gz: '09f47a25bf6389a17c37b0f3a4022909aa136ee1075a3a9cf15a8d44d3ed9d087f5310505b6bbf403823883fb264dd983c1623c9974ad09a83e7927a117df6bd'
7
- data.tar.gz: bbcb4b81733815ebbebcd5f63d1f2660af3c609be94cd8b4f059666990f080c259aaa702726c915da2de74295235bffde8c0f01790e95efe592eaae9700719eb
6
+ metadata.gz: 3ec31b4b9d2ec1850cd8645a3795a4cd277c69e942cb7726f5b9019807469c78f51ba2eeb341212ca4502fa7b34918b8317045b55f8f8df5bfe3434693acd21a
7
+ data.tar.gz: 8c4e1369595539088d60d6af74601e26fbd0528208d481c6cf38f7f57809e2ad71e2a93deeb3257b053c4b23403f6a66d73c6d9ca809e3d80684c7d5b329d3ac
@@ -3,16 +3,16 @@ module GtmOnRails
3
3
  class DataLayer
4
4
  include ActionView::Helpers::TagHelper
5
5
 
6
- attr_reader :objects
6
+ attr_accessor :objects
7
7
 
8
8
  def initialize(*args)
9
9
  options = args.extract_options!
10
- @objects = args # @objects are instances of GTM::DataLayerObject
10
+ @objects = [args].flatten # @objects are instances of GTM::DataLayerObject
11
11
  end
12
12
 
13
- def push(objects)
14
- objects = [objects].flatten
15
- objects.each do |object|
13
+ def push(args)
14
+ args = [args].flatten
15
+ args.each do |object|
16
16
  case object
17
17
  when Hash
18
18
  @objects << GtmOnRails::DataLayer::Object.new(object)
@@ -43,5 +43,17 @@ module GtmOnRails
43
43
  def print_on_html
44
44
  content_tag(:script, self.to_js)
45
45
  end
46
+
47
+ def method_missing(method, *args, &block)
48
+ if @objects.respond_to?(method)
49
+ @objects.send(method, *args, &block)
50
+ else
51
+ super
52
+ end
53
+ end
54
+
55
+ def respond_to?(method, include_all=false)
56
+ Array.new.respond_to?(method, include_all) || super
57
+ end
46
58
  end
47
59
  end
@@ -1,3 +1,3 @@
1
1
  module GtmOnRails
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtm_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ykogure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-28 00:00:00.000000000 Z
11
+ date: 2017-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails