filters: refactor #sample to leave off the arg
This commit is contained in:
parent
2e91d094e5
commit
47d2a2459d
|
@ -283,11 +283,11 @@ module Jekyll
|
||||||
|
|
||||||
def sample(input, num = 1)
|
def sample(input, num = 1)
|
||||||
return input unless input.respond_to?(:sample)
|
return input unless input.respond_to?(:sample)
|
||||||
sampling = input.sample(num)
|
n = num.to_i rescue 1
|
||||||
if num == 1
|
if n == 1
|
||||||
sampling.first
|
input.sample
|
||||||
else
|
else
|
||||||
sampling
|
input.sample(n)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue