Class: Array

Inherits:
Object show all
Defined in:
lib/sup/util.rb

Instance Method Summary collapse

Instance Method Details

#flatten_one_levelObject



615
616
617
# File 'lib/sup/util.rb', line 615

def flatten_one_level
  inject([]) { |a, e| a + e }
end

#last=(e) ⇒ Object



624
# File 'lib/sup/util.rb', line 624

def last= e; self[-1] = e end

#nonempty?Boolean

Returns:

  • (Boolean)


625
# File 'lib/sup/util.rb', line 625

def nonempty?; !empty? end

#restObject



620
# File 'lib/sup/util.rb', line 620

def rest; self[1..-1]; end

#to_boolean_hObject



622
# File 'lib/sup/util.rb', line 622

def to_boolean_h; Hash[*map { |x| [x, true] }.flatten]; end

#to_hObject



619
# File 'lib/sup/util.rb', line 619

def to_h; Hash[*flatten]; end