cerulean 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cerulean.rb +11 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e59127223d322340bed7b946c251e91d6ff40f5
4
- data.tar.gz: 2afc6f7147fb46f37c4655acf2880008999292ea
3
+ metadata.gz: 27afad5987be82e117bf2fa411fde273586a3b12
4
+ data.tar.gz: 200728caeb772a89305dc50961ab9208b58e9208
5
5
  SHA512:
6
- metadata.gz: 552bb530592c91527815d4e82ffa12cac3b7f6414ca22eadb3e6c0d86e171b2fed1ab965e9b77a1e1c8b5bd2af391e3c7cd8194a1db51b09cdd3595c5d8f0288
7
- data.tar.gz: 59d14a6d765f795c7e26c8e9790654c7124b4516b8cd3a2e5203fa8ed9d103d3e524f61083d9beb7379977449343afed8799a622a319f09d847ad1880b0eae96
6
+ metadata.gz: cd5f129539e9c7c5ba3fc7307163e1f552628a64b9bac3bf5585b08ee28cf144a2fca0808981ed9bd5b853f7f04f0a418b930cac8ba3b98eb0ebe44e823ba4ce
7
+ data.tar.gz: 62bcb90d95cacf2aadb44b96b2c7cba3bc8a5032ed61e4594052d9e723991cde5ed75d47c907be059e0fd54fa01eb2e0e128d131a41e01b81988200fa3eaa094
data/lib/cerulean.rb CHANGED
@@ -60,11 +60,19 @@ module Cerulean
60
60
  @declared ||= {} #Hashie::Mash.new(params)
61
61
  end
62
62
 
63
- def present(object, opts={})
63
+ def present(object, **opts)
64
64
  if object.is_a?(Array) || object.is_a?(ActiveRecord::Relation)
65
- render json: object.map { |el| meta[:presenter].new(el).as_json(**opts) }
65
+ if opts.any?
66
+ render json: object.map { |el| meta[:presenter].new(el).as_json(**opts) }
67
+ else
68
+ render json: object.map { |el| meta[:presenter].new(el).as_json() }
69
+ end
66
70
  else
67
- render json: meta[:presenter].new(object).as_json(**opts)
71
+ if opts.any?
72
+ render json: meta[:presenter].new(object).as_json(**opts)
73
+ else
74
+ render json: meta[:presenter].new(object).as_json()
75
+ end
68
76
  end
69
77
  end
70
78
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cerulean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Kestell