beret 0.2.0 → 0.3.0

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: 3a817f9ff6f03c7ae6d433570a362cfb69aa8f77
4
- data.tar.gz: 8f13e43d494aa258a1fc6ecdf8f52ae54ff66ce9
3
+ metadata.gz: 6490a904f8d44b4742981355f88f276ffc6b15cf
4
+ data.tar.gz: 2f242277dc37205dfe6ea83831dd37e472fd5ff5
5
5
  SHA512:
6
- metadata.gz: ec88df2a4876be85eb9f3797e23e197130cc54d1bae0f7d1580aa9c0ab4f800e960e1458046847f37affee04a7d08b038f82c5ecbf09d4a9732630dd902dc0ab
7
- data.tar.gz: 18756d96c65e26303c8d3c79b212dea5ae6dda16de0ca70056d7da78f15e803c3975c5f117faf6a50d3b815810d7642854435a4c65b22c140b4d119666dcaf2f
6
+ metadata.gz: 73920e909c96e1aecca8d5b1f5c7611ad8a2495e78a578f2a9dd7825ac8f7104f979af9464f9ee37c52a17397ce1ecc3d87d3cc083d34e3f6c6bff653a0a56ad
7
+ data.tar.gz: 6dc79c0ce717b81d84b67c23530de3ab3121cd2d296c638be8664e346c8d6f1ab3b97a653363bd161057fa75cc92bd1c635984913962353ba94a710468dd1a18
data/README.md CHANGED
@@ -31,14 +31,16 @@ ck_json = "[{\"content\":{\"text\":\"This is some text.\"},\"type\":\"redactor\"
31
31
  beret = Beret.new(ck_json)
32
32
 
33
33
  # Finding values
34
- beret.find(field: :photo_id) # => [<Beret::Result value="42">, <Beret::Result value="144">]
35
- beret.find(field: :photo_id, in: [:image]) # => [<Beret::Result value="42">]
36
- beret.find(field: :photo_id, in: [:avatar]) # => [<Beret::Result value="144">]
37
- beret.find(field: :photo_id, in: [:some_other_block_type]) # => []
34
+ beret.find(:photo_id) # => [<Beret::Result value="42">, <Beret::Result value="144">]
35
+ beret.find(:photo_id, in: [:image]) # => [<Beret::Result value="42">]
36
+ beret.find(:photo_id, in: [:avatar]) # => [<Beret::Result value="144">]
37
+ beret.find(:photo_id, in: [:some_other_block_type]) # => []
38
38
 
39
39
  # In-place updating
40
- beret.update(:count, in: [:kitten_count]) do |value|
41
- value + " kittens"
40
+ beret.update(:photo_id, in: [:image]) do |value|
41
+ # Transform the value any way you'd like here.
42
+ # In this example, we convert a plain old ID to a SGID
43
+ Image.find(value).to_sgid
42
44
  end
43
45
 
44
46
  # Retrieving JSON
@@ -5,11 +5,11 @@ module Beret
5
5
  @block_json = block_json
6
6
  end
7
7
 
8
- def find(field_name, options)
8
+ def find(field_name, options={})
9
9
  Search.new(blocks, field_name, options).results
10
10
  end
11
11
 
12
- def update(field_name, options)
12
+ def update(field_name, options={})
13
13
  results = find(field_name, options)
14
14
 
15
15
  results.each do |result|
data/lib/beret/version.rb CHANGED
@@ -2,7 +2,7 @@ module Beret
2
2
 
3
3
  VERSION = [
4
4
  0, # major
5
- 2, # minor
5
+ 3, # minor
6
6
  0 # patch
7
7
  ].join('.')
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beret
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lawson Kurtz (Viget)