Class: Array

Inherits:
Object show all
Defined in:
lib/moon/packages/std/core_ext/array.rb,
lib/moon/packages/micro_json/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Determines if the object is blank?

Returns:


7
8
9
# File 'lib/moon/packages/std/core_ext/array.rb', line 7

def blank?
  empty?
end

#singularizeself, Object

If the Array only has 1 element, returns it, else returns the entire array.

Returns:


14
15
16
# File 'lib/moon/packages/std/core_ext/array.rb', line 14

def singularize
  size > 1 ? self : first
end

#to_jsonString

Dumps the Array as a JSON string.

Returns:


5
6
7
# File 'lib/moon/packages/micro_json/core_ext/array.rb', line 5

def to_json
  JSON.dump(self)
end