4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/halbuilder/embed.rb', line 4
def hal_embed!(rel, *args, &block)
collection = :not_provided
opts = {}
if args.count > 1
collection = args[0]
opts = args[1]
elsif args[0].is_a?(Hash)
opts = args[0]
elsif args.length > 0
collection = args[0]
end
if hal_zoomed?(rel, opts[:zoom])
set! Halbuilder.configuration.embed_key do
set! rel do
collection = collection.call if collection.is_a?(Proc)
if collection.respond_to?(:each) && !collection.is_a?(Hash)
array! collection do |c|
block.call(c)
end
elsif collection.present? || collection == :not_provided
block.call(collection)
else
null!
end
end
end
end
end
|