dato 0.6.15 → 0.6.16

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
  SHA256:
3
- metadata.gz: 18f6bab733bb56da0e48f7141e919700ecf428d7dafa5e79812bdd01de16c5bc
4
- data.tar.gz: 6b2f8b434254f0830c5c7d3e1a729f8752474ddab549e2b1bcc85771f0d0a136
3
+ metadata.gz: '0313587907c1cc2e822ad7f92aac1284cbfdb9f451758bc3388c9b5a28d6306b'
4
+ data.tar.gz: e042db396497a20f4fe597665f8fd839c637b4a615d92b011ac06d33a07b5b94
5
5
  SHA512:
6
- metadata.gz: b8cc64b4cafeed1887cbc481f7e01c89ace6ba1597082b2ae42adf03c2a4ad284db40e920a060bcb9b91f7516b3466f8d8456c0f816ccf29c7d4ae3dc0bf1e84
7
- data.tar.gz: e2d408db575c37e60f33c472ce4c6698d4dc115e7c95757a788414d4822ca2dd129a7007f034e6091f554a5d23caf506f0b59113a41c6fc7fa1659d865edd478
6
+ metadata.gz: e59fd529748e518483c0d7769059c1a7ec9df4e2991a9dcfa2d71aeb980340fcc724144106249668e92bfd311e18f16f97f118cc210f701d74a9fb46ed46a44b
7
+ data.tar.gz: 8b6c5ed1246ebf78c176dff63d64ca26a3e0d7f004ed73a1e8761beb4c9c503b9a7d6c31064bad3db9ada82e1cb50d206612879e249197c8d25709138fd3a3f3
@@ -47,7 +47,7 @@ module Dato
47
47
  fields.each_with_object(
48
48
  ActiveSupport::HashWithIndifferentAccess.new
49
49
  ) do |field, acc|
50
- acc[field.api_key.to_sym] = send(field.api_key)
50
+ acc[field.api_key.to_sym] = read_attribute(field.api_key, field)
51
51
  end
52
52
  end
53
53
 
@@ -77,6 +77,10 @@ module Dato
77
77
  end
78
78
  alias inspect to_s
79
79
 
80
+ def [](key)
81
+ attributes[key.to_sym]
82
+ end
83
+
80
84
  def to_hash(max_depth = 3, current_depth = 0)
81
85
  return id if current_depth >= max_depth
82
86
 
@@ -121,10 +125,10 @@ module Dato
121
125
  type_klass = type_klass_name.safe_constantize
122
126
 
123
127
  value = if field.localized
124
- obj = entity.send(method) || {}
128
+ obj = entity[method] || {}
125
129
  Utils::LocaleValue.find(obj)
126
130
  else
127
- entity.send(method)
131
+ entity[method]
128
132
  end
129
133
 
130
134
  if type_klass
@@ -137,7 +137,7 @@ module Dato
137
137
  @collections_by_type[method].sort_by!(&:position)
138
138
  elsif item_type.ordering_field
139
139
  @collections_by_type[method].sort_by! do |item|
140
- item.send(item_type.ordering_field.api_key)
140
+ item[item_type.ordering_field.api_key]
141
141
  end
142
142
  if item_type.ordering_direction == 'desc'
143
143
  @collections_by_type[method].reverse!
@@ -38,7 +38,7 @@ module Dato
38
38
  alias inspect to_s
39
39
 
40
40
  def [](key)
41
- attributes[key]
41
+ attributes[key.to_sym]
42
42
  end
43
43
 
44
44
  def respond_to_missing?(method, include_private = false)
@@ -60,11 +60,11 @@ module Dato
60
60
 
61
61
  def read_attribute(method, type_klass, localized)
62
62
  value = if localized
63
- obj = entity.send(method) || {}
63
+ obj = entity[method] || {}
64
64
 
65
65
  Utils::LocaleValue.find(obj)
66
66
  else
67
- entity.send(method)
67
+ entity[method]
68
68
  end
69
69
 
70
70
  type_klass.parse(value, @items_repo)
@@ -22,8 +22,8 @@ module Dato
22
22
  item.fields.detect { |f| f.field_type == 'seo' }
23
23
 
24
24
  item_seo_value = seo_field &&
25
- item.send(seo_field.api_key) &&
26
- item.send(seo_field.api_key).send(attribute)
25
+ item[seo_field.api_key] &&
26
+ item[seo_field.api_key].send(attribute)
27
27
 
28
28
  fallback_seo_value = fallback_seo &&
29
29
  fallback_seo.send(attribute)
@@ -22,7 +22,7 @@ module Dato
22
22
  def item_image
23
23
  item && item.fields
24
24
  .select { |field| field.field_type == 'file' }
25
- .map { |field| item.send(field.api_key) }
25
+ .map { |field| item[field.api_key] }
26
26
  .compact
27
27
  .find do |image|
28
28
 
@@ -23,7 +23,7 @@ module Dato
23
23
  def item_title
24
24
  @item_title ||= seo_field_with_fallback(
25
25
  :title,
26
- title_field && item.send(title_field.api_key)
26
+ title_field && item[title_field.api_key]
27
27
  )
28
28
  end
29
29
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dato
4
- VERSION = '0.6.15'
4
+ VERSION = '0.6.16'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.15
4
+ version: 0.6.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-16 00:00:00.000000000 Z
11
+ date: 2019-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler