Class: Array

Inherits:
Object show all
Defined in:
lib/ascension.rb,
lib/ascension/to_json.rb

Instance Method Summary collapse

Instance Method Details

#as_json(*args) ⇒ Object



59
60
61
62
63
# File 'lib/ascension/to_json.rb', line 59

def as_json(*args)
  map do |obj|
    obj.respond_to?(:as_json) ? obj.as_json(*args) : obj
  end
end

#sumObject



19
20
21
# File 'lib/ascension.rb', line 19

def sum
  inject { |s,i| s + i }
end